aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs89
1 files changed, 85 insertions, 4 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 8c51473..fd8e586 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -7479,7 +7479,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7479 public LSL_String llSHA1String(string src) 7479 public LSL_String llSHA1String(string src)
7480 { 7480 {
7481 m_host.AddScriptLPS(1); 7481 m_host.AddScriptLPS(1);
7482 return Util.SHA1Hash(src, Encoding.UTF8).ToLower(); 7482 return Util.SHA1Hash(src, Encoding.UTF8).ToUpper();
7483 } 7483 }
7484 7484
7485 protected ObjectShapePacket.ObjectDataBlock SetPrimitiveBlockShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, byte profileshape, byte pathcurve) 7485 protected ObjectShapePacket.ObjectDataBlock SetPrimitiveBlockShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist, byte profileshape, byte pathcurve)
@@ -8676,10 +8676,91 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8676 8676
8677 public LSL_String llXorBase64Strings(string str1, string str2) 8677 public LSL_String llXorBase64Strings(string str1, string str2)
8678 { 8678 {
8679 m_host.AddScriptLPS(1); 8679 string b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
8680 Deprecated("llXorBase64Strings"); 8680
8681 ScriptSleep(300); 8681 ScriptSleep(300);
8682 return String.Empty; 8682 m_host.AddScriptLPS(1);
8683
8684 if (str1 == String.Empty)
8685 return String.Empty;
8686 if (str2 == String.Empty)
8687 return str1;
8688
8689 int len = str2.Length;
8690 if ((len % 4) != 0) // LL is EVIL!!!!
8691 {
8692 while (str2.EndsWith("="))
8693 str2 = str2.Substring(0, str2.Length - 1);
8694
8695 len = str2.Length;
8696 int mod = len % 4;
8697
8698 if (mod == 1)
8699 str2 = str2.Substring(0, str2.Length - 1);
8700 else if (mod == 2)
8701 str2 += "==";
8702 else if (mod == 3)
8703 str2 += "=";
8704 }
8705
8706 byte[] data1;
8707 byte[] data2;
8708 try
8709 {
8710 data1 = Convert.FromBase64String(str1);
8711 data2 = Convert.FromBase64String(str2);
8712 }
8713 catch (Exception)
8714 {
8715 return new LSL_String(String.Empty);
8716 }
8717
8718 // For cases where the decoded length of s2 is greater
8719 // than the decoded length of s1, simply perform a normal
8720 // decode and XOR
8721 //
8722 if (data2.Length >= data1.Length)
8723 {
8724 for (int pos = 0 ; pos < data1.Length ; pos++ )
8725 data1[pos] ^= data2[pos];
8726
8727 return Convert.ToBase64String(data1);
8728 }
8729
8730 // Remove padding
8731 while (str1.EndsWith("="))
8732 str1 = str1.Substring(0, str1.Length - 1);
8733 while (str2.EndsWith("="))
8734 str2 = str2.Substring(0, str2.Length - 1);
8735
8736 byte[] d1 = new byte[str1.Length];
8737 byte[] d2 = new byte[str2.Length];
8738
8739 for (int i = 0 ; i < str1.Length ; i++)
8740 {
8741 int idx = b64.IndexOf(str1.Substring(i, 1));
8742 if (idx == -1)
8743 idx = 0;
8744 d1[i] = (byte)idx;
8745 }
8746
8747 for (int i = 0 ; i < str2.Length ; i++)
8748 {
8749 int idx = b64.IndexOf(str2.Substring(i, 1));
8750 if (idx == -1)
8751 idx = 0;
8752 d2[i] = (byte)idx;
8753 }
8754
8755 string output = String.Empty;
8756
8757 for (int pos = 0 ; pos < d1.Length ; pos++)
8758 output += b64[d1[pos] ^ d2[pos % d2.Length]];
8759
8760 while (output.Length % 3 > 0)
8761 output += "=";
8762
8763 return output;
8683 } 8764 }
8684 8765
8685 public void llRemoteDataSetRegion() 8766 public void llRemoteDataSetRegion()