diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 40 |
1 files changed, 30 insertions, 10 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index fb191e6..d49bbb2 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -9829,19 +9829,39 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9829 | public LSL_String llXorBase64StringsCorrect(string str1, string str2) | 9829 | public LSL_String llXorBase64StringsCorrect(string str1, string str2) |
9830 | { | 9830 | { |
9831 | m_host.AddScriptLPS(1); | 9831 | m_host.AddScriptLPS(1); |
9832 | string ret = String.Empty; | 9832 | |
9833 | string src1 = llBase64ToString(str1); | 9833 | if (str1 == String.Empty) |
9834 | string src2 = llBase64ToString(str2); | 9834 | return String.Empty; |
9835 | int c = 0; | 9835 | if (str2 == String.Empty) |
9836 | for (int i = 0; i < src1.Length; i++) | 9836 | return str1; |
9837 | |||
9838 | byte[] data1 = Convert.FromBase64String(str1); | ||
9839 | byte[] data2 = Convert.FromBase64String(str2); | ||
9840 | |||
9841 | byte[] d2 = new Byte[data1.Length]; | ||
9842 | int pos = 0; | ||
9843 | |||
9844 | if (data1.Length <= data2.Length) | ||
9837 | { | 9845 | { |
9838 | ret += (char) (src1[i] ^ src2[c]); | 9846 | Array.Copy(data2, 0, d2, 0, data1.Length); |
9847 | } | ||
9848 | else | ||
9849 | { | ||
9850 | while (pos < data1.Length) | ||
9851 | { | ||
9852 | int len = data1.Length - pos; | ||
9853 | if (len > data2.Length) | ||
9854 | len = data2.Length; | ||
9839 | 9855 | ||
9840 | c++; | 9856 | Array.Copy(data2, 0, d2, pos, len); |
9841 | if (c >= src2.Length) | 9857 | pos += len; |
9842 | c = 0; | 9858 | } |
9843 | } | 9859 | } |
9844 | return llStringToBase64(ret); | 9860 | |
9861 | for (pos = 0 ; pos < data1.Length ; pos++ ) | ||
9862 | data1[pos] ^= d2[pos]; | ||
9863 | |||
9864 | return Convert.ToBase64String(data1); | ||
9845 | } | 9865 | } |
9846 | 9866 | ||
9847 | public LSL_String llHTTPRequest(string url, LSL_List parameters, string body) | 9867 | public LSL_String llHTTPRequest(string url, LSL_List parameters, string body) |