如何在适合PHP SHA512的C#中重现SHA512哈希?

Laz*_*zlo 7 .net php c# hash sha512

这个问题几乎是不言自明的.我用Google搜索了许多网站,很多方法,尝试了很多编码,但我无法让它匹配.

我正在尝试使字符串"asdasd"匹配.(http://www.fileformat.info/tool/hash.htm?text=asdasd)

The*_*att 17

试试这个

using System.Security.Cryptography

public static string HashPassword(string unhashedPassword)
{
    return BitConverter.ToString(new SHA512CryptoServiceProvider().ComputeHash(Encoding.Default.GetBytes(unhashedPassword))).Replace("-", String.Empty).ToUpper();
}
Run Code Online (Sandbox Code Playgroud)

  • 简单,漂亮,小巧,快速让我们说完美! (2认同)