* Minor tweaks with new userserver

* Fixed password encoding to match MD5 standard properly.
* Fixed exception caused on user first login (minor)
* Fixed exception caused by incorrect username (minor)
* Returns login error rather than grid error if username is incorrect
This commit is contained in:
Adam Frisby
2007-05-20 23:34:29 +00:00
parent 7d29bd138f
commit b2fe47ecb1
3 changed files with 31 additions and 13 deletions

View File

@@ -1,4 +1,5 @@
using System;
using System.Security.Cryptography;
using System.Collections.Generic;
using System.Text;
using libsecondlife;
@@ -43,6 +44,16 @@ namespace OpenSim.Framework.Utilities
return timestamp;
}
public static string Md5Hash(string pass)
{
MD5 md5 = MD5CryptoServiceProvider.Create();
byte[] dataMd5 = md5.ComputeHash(Encoding.Default.GetBytes(pass));
StringBuilder sb = new StringBuilder();
for (int i = 0; i < dataMd5.Length; i++)
sb.AppendFormat("{0:x2}", dataMd5[i]);
return sb.ToString();
}
//public static int fast_distance2d(int x, int y)
//{
// x = System.Math.Abs(x);