From ea6e4a95ce5e0fc8c5e3d049b43b9cc0ada65491 Mon Sep 17 00:00:00 2001
From: idb
Date: Thu, 29 Jan 2009 19:47:55 +0000
Subject: Complete the implementation of llSHA1String.
---
OpenSim/Framework/Util.cs | 11 +++++++++++
.../Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 3 ++-
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 7217ece..df7a552 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -334,6 +334,17 @@ namespace OpenSim.Framework
return sb.ToString();
}
+ ///
+ /// Return an SHA1 hash of the given string
+ ///
+ ///
+ ///
+ public static string SHA1Hash(string src)
+ {
+ SHA1CryptoServiceProvider SHA1 = new SHA1CryptoServiceProvider();
+ return BitConverter.ToString(SHA1.ComputeHash(Encoding.Default.GetBytes(src))).Replace("-", String.Empty);
+ }
+
public static int fast_distance2d(int x, int y)
{
x = Math.Abs(x);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 10a3133..36b524a 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -5890,8 +5890,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_String llSHA1String(string src)
{
m_host.AddScriptLPS(1);
- return ""; //ckrinke 1/27 This needs to return a proper hash.
+ return Util.SHA1Hash(src).ToLower();
}
+
private ObjectShapePacket.ObjectDataBlock SetPrimitiveBlockShapeParams(SceneObjectPart part, int holeshape, LSL_Vector cut, float hollow, LSL_Vector twist)
{
ObjectShapePacket.ObjectDataBlock shapeBlock = new ObjectShapePacket.ObjectDataBlock();
--
cgit v1.1