Code: Select all
private byte[] GenerateAESKey1(byte[] password)
{
…
for (int i = 0; i < 8192; i++)
{
m_hash.Initialize();
m_hash.TransformBlock(key, 0, key.Length, key, 0);
m_hash.TransformFinalBlock(password, 0, password.Length);
key = m_hash.Hash;
}
return key;
}
Note that AES Crypt would not need to implement any KDFs itself, keeping code modifications at a minimum. For example, the Microsoft.AspNetCore.Cryptography.KeyDerivation package already provides a tried-and-tested PBKDF2 implementation for .NET projects.
Regards
Christoph