diff options
Diffstat (limited to 'OpenSim.Framework/Util.cs')
-rw-r--r-- | OpenSim.Framework/Util.cs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/OpenSim.Framework/Util.cs b/OpenSim.Framework/Util.cs index 6f60925..400f415 100644 --- a/OpenSim.Framework/Util.cs +++ b/OpenSim.Framework/Util.cs | |||
@@ -1,4 +1,5 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Security.Cryptography; | ||
2 | using System.Collections.Generic; | 3 | using System.Collections.Generic; |
3 | using System.Text; | 4 | using System.Text; |
4 | using libsecondlife; | 5 | using libsecondlife; |
@@ -43,6 +44,16 @@ namespace OpenSim.Framework.Utilities | |||
43 | return timestamp; | 44 | return timestamp; |
44 | } | 45 | } |
45 | 46 | ||
47 | public static string Md5Hash(string pass) | ||
48 | { | ||
49 | MD5 md5 = MD5CryptoServiceProvider.Create(); | ||
50 | byte[] dataMd5 = md5.ComputeHash(Encoding.Default.GetBytes(pass)); | ||
51 | StringBuilder sb = new StringBuilder(); | ||
52 | for (int i = 0; i < dataMd5.Length; i++) | ||
53 | sb.AppendFormat("{0:x2}", dataMd5[i]); | ||
54 | return sb.ToString(); | ||
55 | } | ||
56 | |||
46 | //public static int fast_distance2d(int x, int y) | 57 | //public static int fast_distance2d(int x, int y) |
47 | //{ | 58 | //{ |
48 | // x = System.Math.Abs(x); | 59 | // x = System.Math.Abs(x); |