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 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'OpenSim/Framework/Util.cs') 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); -- cgit v1.1