module Hash: sig
.. end
The Hash
module implements unkeyed cryptographic hashes (SHA-1,
SHA-256, RIPEMD-160 and MD5), also known as message digest functions.
Hash functions used in cryptography are characterized as being
one-way (given a hash value, it is computationally
infeasible to find a text that hashes to this value) and
collision-resistant (it is computationally infeasible to
find two different texts that hash to the same value). Thus, the
hash of a text can be used as a compact replacement for this text
for the purposes of ensuring integrity of the text.
val sha1 : unit -> Cryptokit.hash
SHA-1 is the Secure Hash Algorithm revision 1. It is a NIST
standard, is widely used, and produces 160-bit hashes (20 bytes).
Recent results suggest that it may not be collision-resistant.
val sha256 : unit -> Cryptokit.hash
SHA-256, another NIST standard, is a variant of SHA-1 that
produces 256-bit hashes (32 bytes).
val sha3 : int -> Cryptokit.hash
SHA-3, the latest NIST standard for cryptographic hashing,
produces hashes of 224, 256, 384 or 512 bits (24, 32, 48 or 64
bytes). The parameter is the desired size of the hash, in
bits. It must be one of 224, 256, 384 or 512.
val ripemd160 : unit -> Cryptokit.hash
RIPEMD-160 produces 160-bit hashes (20 bytes).
val md5 : unit -> Cryptokit.hash
MD5 is an older hash function, producing 128-bit hashes (16 bytes).
While popular in many legacy applications, it is now
considered as unsecure. In particular, it is not
collision-resistant.