diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 5141e0e..aaf1170 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -8540,6 +8540,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8540 | 8540 | ||
8541 | public LSL_String llXorBase64Strings(string str1, string str2) | 8541 | public LSL_String llXorBase64Strings(string str1, string str2) |
8542 | { | 8542 | { |
8543 | int padding = 0; | ||
8544 | |||
8543 | string b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; | 8545 | string b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; |
8544 | 8546 | ||
8545 | ScriptSleep(300); | 8547 | ScriptSleep(300); |
@@ -8583,6 +8585,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8583 | // than the decoded length of s1, simply perform a normal | 8585 | // than the decoded length of s1, simply perform a normal |
8584 | // decode and XOR | 8586 | // decode and XOR |
8585 | // | 8587 | // |
8588 | /* | ||
8586 | if (data2.Length >= data1.Length) | 8589 | if (data2.Length >= data1.Length) |
8587 | { | 8590 | { |
8588 | for (int pos = 0 ; pos < data1.Length ; pos++ ) | 8591 | for (int pos = 0 ; pos < data1.Length ; pos++ ) |
@@ -8590,10 +8593,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8590 | 8593 | ||
8591 | return Convert.ToBase64String(data1); | 8594 | return Convert.ToBase64String(data1); |
8592 | } | 8595 | } |
8596 | */ | ||
8593 | 8597 | ||
8594 | // Remove padding | 8598 | // Remove padding |
8595 | while (str1.EndsWith("=")) | 8599 | while (str1.EndsWith("=")) |
8600 | { | ||
8596 | str1 = str1.Substring(0, str1.Length - 1); | 8601 | str1 = str1.Substring(0, str1.Length - 1); |
8602 | padding++; | ||
8603 | } | ||
8597 | while (str2.EndsWith("=")) | 8604 | while (str2.EndsWith("=")) |
8598 | str2 = str2.Substring(0, str2.Length - 1); | 8605 | str2 = str2.Substring(0, str2.Length - 1); |
8599 | 8606 | ||
@@ -8621,7 +8628,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8621 | for (int pos = 0 ; pos < d1.Length ; pos++) | 8628 | for (int pos = 0 ; pos < d1.Length ; pos++) |
8622 | output += b64[d1[pos] ^ d2[pos % d2.Length]]; | 8629 | output += b64[d1[pos] ^ d2[pos % d2.Length]]; |
8623 | 8630 | ||
8624 | while (output.Length % 3 > 0) | 8631 | // Here's a funny thing: LL blithely violate the base64 |
8632 | // standard pretty much everywhere. Here, padding is | ||
8633 | // added only if the first input string had it, rather | ||
8634 | // than when the data actually needs it. This can result | ||
8635 | // in invalid base64 being returned. Go figure. | ||
8636 | |||
8637 | while (padding-- > 0) | ||
8625 | output += "="; | 8638 | output += "="; |
8626 | 8639 | ||
8627 | return output; | 8640 | return output; |