aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Util.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Util.cs')
-rw-r--r--OpenSim/Framework/Util.cs12
1 files changed, 9 insertions, 3 deletions
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 9227708..96292ff 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -435,16 +435,22 @@ namespace OpenSim.Framework
435 /// </summary> 435 /// </summary>
436 /// <param name="data"></param> 436 /// <param name="data"></param>
437 /// <returns></returns> 437 /// <returns></returns>
438
438 public static string SHA1Hash(string data) 439 public static string SHA1Hash(string data)
439 { 440 {
440 byte[] hash = ComputeSHA1Hash(data); 441 return SHA1Hash(data, Encoding.Default);
442 }
443
444 public static string SHA1Hash(string data, Encoding encoding)
445 {
446 byte[] hash = ComputeSHA1Hash(data, encoding);
441 return BitConverter.ToString(hash).Replace("-", String.Empty); 447 return BitConverter.ToString(hash).Replace("-", String.Empty);
442 } 448 }
443 449
444 private static byte[] ComputeSHA1Hash(string src) 450 private static byte[] ComputeSHA1Hash(string src, Encoding encoding)
445 { 451 {
446 SHA1CryptoServiceProvider SHA1 = new SHA1CryptoServiceProvider(); 452 SHA1CryptoServiceProvider SHA1 = new SHA1CryptoServiceProvider();
447 return SHA1.ComputeHash(Encoding.Default.GetBytes(src)); 453 return SHA1.ComputeHash(encoding.GetBytes(src));
448 } 454 }
449 455
450 public static int fast_distance2d(int x, int y) 456 public static int fast_distance2d(int x, int y)