【发布时间】:2013-02-25 16:49:10
【问题描述】:
我正在使用 AES (Rijndael) 对称密钥算法来加密-解密数据。 我正在使用 System.Security.Cryptography。 PasswordDeriveBytes 函数;
PasswordDeriveBytes password = new PasswordDeriveBytes(
passPhrase,
saltValueBytes,
hashAlgorithm,
passwordIterations);
在 MSDN 等上查找此函数,它并没有明确告诉您“hashAlgoritm”可以采用哪些参数。 互联网上有使用 SHA1 和 SHA256 的示例。我对此进行了实验,发现它可以采用 SHA512。 但是没有文档,我不知道 SHA512 是否真的比 SHA256 或 SHA1 甚至 MD5 更好。 有人能解释一下这个问题吗?
【问题讨论】:
-
MD5 几年前就坏了,所以不要使用那个!
-
PasswordDerivedBytes 只是生成从哈希派生的会话密钥。选择一个目前不知道在某些方面不安全的算法。
-
@PeterRichie 不同意,KDF 有其他安全要求
-
@PeterRitchie 密码哈希和通用哈希非常不同。所以其他问题显然不是重复的。
标签: c# .net encryption