nettle: Hash functions
1
1 6.1 Hash functions
1 ==================
1
1 A cryptographic “hash function” is a function that takes variable size
1 strings, and maps them to strings of fixed, short, length. There are
1 naturally lots of collisions, as there are more possible 1MB files than
1 20 byte strings. But the function is constructed such that is hard to
1 find the collisions. More precisely, a cryptographic hash function ‘H’
1 should have the following properties:
1
1 _One-way_
1 Given a hash value ‘H(x)’ it is hard to find a string ‘x’ that
1 hashes to that value.
1
1 _Collision-resistant_
1 It is hard to find two different strings, ‘x’ and ‘y’, such that
1 ‘H(x)’ = ‘H(y)’.
1
1 Hash functions are useful as building blocks for digital signatures,
1 message authentication codes, pseudo random generators, association of
1 unique ids to documents, and many other things.
1
1 The most commonly used hash functions are MD5 and SHA1.
1 Unfortunately, both these fail the collision-resistance requirement;
1 cryptologists have found ways to construct colliding inputs. The
1 recommended hash functions for new applications are SHA2 (with main
1 variants SHA256 and SHA512). At the time of this writing (Autumn 2015),
1 SHA3 has recently been standardized, and the new SHA3 and other top SHA3
1 candidates may also be reasonable alternatives.
1
Menu