我想使用SHA1进行加密.我的代码是
public static string EncryptPassword(string password)
{
try
{
SHA1 sha1 = new SHA1Managed();
var bytehash = sha1.ComputeHash(new MemoryStream(new ASCIIEncoding().GetBytes(password)));
var stringhash = new ASCIIEncoding().GetChars(bytehash).ToString();
return stringhash;
}
catch (Exception ex)
{
// Some Exception....
}
return null;
}
Run Code Online (Sandbox Code Playgroud)
它不起作用.它只返回System.Char [].我在这做错了什么