module Hash = struct ... end
The Hash
module implements unkeyed cryptographic hashes SHA-1
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 has no known weaknesses.
It 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 applications, it is considered as
potentially slightly weaker than SHA-1.