Out with the new! In with the old!
This commit is contained in:
parent
2c5f6387a6
commit
c5c0a7e506
1 changed files with 4 additions and 10 deletions
|
|
@ -651,16 +651,10 @@ namespace TShockAPI
|
|||
/// <returns>string sha256</returns>
|
||||
public static string HashPassword(string password)
|
||||
{
|
||||
byte[] data = StrToByteArray(password);
|
||||
byte[] result;
|
||||
byte[] final;
|
||||
using (SHA256 shaM = new SHA256Managed())
|
||||
{
|
||||
result = shaM.ComputeHash(data);
|
||||
}
|
||||
System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding();
|
||||
final = Encoding.UTF8.GetBytes(enc.GetString(result));
|
||||
return BitConverter.ToString(final);
|
||||
Encoding enc = System.Text.Encoding.UTF8;
|
||||
byte[] buffer = enc.GetBytes(password);
|
||||
SHA1CryptoServiceProvider cryptoTransformSHA1 = new SHA1CryptoServiceProvider();
|
||||
return BitConverter.ToString(cryptoTransformSHA1.ComputeHash(buffer)).Replace("-", "");
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue