开发者

Do encryption algorithms require an internal hashing algorithm?

When I use C# to implement the AES symmetric encryption cipher, I noticed:

PasswordDeriveBytes derivedPassword = new PasswordDeriveBytes(password, saltBytesArray, hashAlgorithmName, numPasswordIterations);

Why do I need to use a hashing algorithm for AES encryption? Aren't they sep开发者_开发技巧arate? Or is the hashing algorithm only used to create a secure key?

The AES algorithm doesn't use a hashing algorithm internally does it?


PasswordDeriveBytes isn't part of AES. It implements an algorithm to derive encryption keys from a password. The algorithm involves the usage of a hash algorithm.


PasswordDeriveBytes is used to derived a symmetric key as well as the IV you are going to use for encryption/decryption. The PasswordDeriveBytes would take an passkey (password in your case), append the salt (saltBytesArray in your case) and hash it (with the algorithm you provided, e.g. SHA or MD5) 'n' many times (numPasswordIterations in your case) and give you the resulatant byte array.

This method is only used to derive the key, this has got nothing to do with encryption decryption per say.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜