1

我在 C# 中有以下代码

PasswordDeriveBytes DerivedPassword = new PasswordDeriveBytes(Password, SaltValueBytes, 
                                              HashAlgorithm, PasswordIterations);
byte[] KeyBytes = DerivedPassword.GetBytes(32);

.Net 的PasswordDeriveBytes用途PBKDF1。我正在使用“SHA1”散列算法来生成 32 字节的密钥。

请告诉我如何在加密++中实现这一点。在使用 PBKDF2 的 crypto++ 中,它生成 20 字节的密钥。如何制作 C# 生成的 32 字节密钥。

4

1 回答 1

2

你不能,因为 PasswordDerivedBytes 不是标准的 PBKDF1,而 crypto++ 实现是。请改用 PBKDF2 实现(.NET 中的 Rfc2898DeriveBytes)。

于 2012-02-11T18:52:11.507 回答