【发布时间】:2011-01-27 00:00:52
【问题描述】:
如何将哈希结果(字节数组)转换为字符串?
byte[] bytePassword = Encoding.UTF8.GetBytes(password);
using (MD5 md5 = MD5.Create())
{
byte[] byteHashedPassword = md5.ComputeHash(bytePassword);
}
我需要将byteHashedPassword 转换为字符串。
【问题讨论】:
-
MD5 已弃用。它本质上是破损的,因为它没有达到抗碰撞或抗原像性的标准。对于密码,最好使用迭代的密钥派生函数,例如 Argon2 或 PDKDF2。
标签: c# hash cryptography md5 cryptographic-hash-function