Out with the new! In with the old!

This commit is contained in:
Lucas Nicodemus 2011-06-30 20:02:47 -06:00
parent 2c5f6387a6
commit c5c0a7e506

View file

@ -651,16 +651,10 @@ namespace TShockAPI
/// <returns>string sha256</returns> /// <returns>string sha256</returns>
public static string HashPassword(string password) public static string HashPassword(string password)
{ {
byte[] data = StrToByteArray(password); Encoding enc = System.Text.Encoding.UTF8;
byte[] result; byte[] buffer = enc.GetBytes(password);
byte[] final; SHA1CryptoServiceProvider cryptoTransformSHA1 = new SHA1CryptoServiceProvider();
using (SHA256 shaM = new SHA256Managed()) return BitConverter.ToString(cryptoTransformSHA1.ComputeHash(buffer)).Replace("-", "");
{
result = shaM.ComputeHash(data);
}
System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding();
final = Encoding.UTF8.GetBytes(enc.GetString(result));
return BitConverter.ToString(final);
} }
} }
} }