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>
|
/// <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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue