我怎样才能重现适合的PHP SHA512在C#中SHA512哈希? [英] How can I reproduce a SHA512 hash in C# that fits the PHP SHA512?

查看:158
本文介绍了我怎样才能重现适合的PHP SHA512在C#中SHA512哈希?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在的问题是pretty的不言自明。我Google了很多网站,很多的方法,尝试了很多编码,但我不能得到它来搭配。

The question is pretty much self-explanatory. I Googled many sites, many methods, tried many encodings, but I can't get it to match.

我试图使字符串asdasd的比赛。 (<一href="http://www.fileformat.info/tool/hash.htm?text=asdasd">http://www.fileformat.info/tool/hash.htm?text=asdasd)

I'm trying to make the string "asdasd" match. (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();
}

这篇关于我怎样才能重现适合的PHP SHA512在C#中SHA512哈希?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆