You need to use a hash algorithm for some purpose (often as a parameter to a MAC), and you want to understand the important concerns so you can determine which algorithm best suits your needs.
Security requirements should be your utmost concern. SHA1 is a generally a good compromise for those in need of efficiency. We recommend that you do not use the popular favorite MD5, particularly in new applications.
Note that outside the context of a well-designed MAC, it is difficult to use a cryptographic hash function securely, as we discuss in Recipe 6.5 through Recipe 6.8.
A secure message digest function (or one-way hash function) should have the following properties:
If given an arbitrary hash value, it should be computationally infeasible to find a plaintext value that generated that hash value.
It should also be computationally infeasible to find out anything about the original plaintext value; the input bits and output bits should not be correlated.
If given a plaintext value and the corresponding hash value, it should be computationally infeasible to find a second plaintext value that gives the same hash value.
It should be computationally infeasible to find two arbitrary inputs that give the same hash value.
It should be computationally infeasible to find two arbitrary inputs that give two hashes that differ ...
No credit card required