Running popular cryptographic hash functions
A cryptographic hash function has specific properties that make it different from other hash functions. First of all, producing a possible input message from a given hash digest output should be intractable, meaning that it must take an exponentially long time to solve in practice.
For example, if a hash produces the digest 66fc01ae071363ceaa4178848c2f6224
, then in principle, discovering the content used to generate a digest should be difficult.
In practice, some hash functions are easier to crack than others. For example, MD5 and SHA-1 are considered trivial to crack and should not be used, but are demonstrated later for completeness. More information about how MD5 and SHA-1 are insecure can be found at http://www.win.tue.nl/hashclash/rogue-ca and https://www.schneier.com/blog/archives/2005/02/cryptanalysis_o.html respectively.
Getting ready
Install the Crypto.Hash
package from Cabal as follows:
$ cabal install cryptohash
How to do it…
Import the...