加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

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

发布时间:2020-12-13 18:07:49 所属栏目:PHP教程 来源:网络整理
导读:这个问题几乎是不言自明的.我用Google搜索了许多网站,很多方法,尝试了很多编码,但我无法让它匹配. 我正在尝试使字符串“asdasd”匹配. (http://www.fileformat.info/tool/hash.htm?text=asdasd) 试试这个 using System.Security.Cryptographypublic static s
这个问题几乎是不言自明的.我用Google搜索了许多网站,很多方法,尝试了很多编码,但我无法让它匹配.

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

试试这个
using System.Security.Cryptography

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读