using BCryptHelper = BCrypt.Net.BCrypt;
public class Cryptography
{
public static string Hash(string Text, out string Salt)
{
Salt = BCryptHelper.GenerateSalt();
return BCryptHelper.HashPassword(Text, Salt);
}
public static bool VerifyHash(string Text, string HashedText)
{
return BCryptHelper.Verify(Text, HashedText);
}
}
方法: 1. 利用亂數加密後的密碼 Hash(要被加密的字串, out 亂數產生的字串)
2. 密碼是否相符 VerifyHash(輸入的字串,亂數加密後的密碼)