The extensive README is also a pretty good intro to how one can do crypto (as in cryptography: get off my lawn!) in Haskell using the excellent <i>cryptonite</i> library.<p>For those who won't click through to TFR:<p><pre><code> > import Crypto.Number.Hash (SHA3_256)
> import Crypto.PubKey.ECC.ECDSA (sign, verify)
> import Crypto.PubKey.ECC.Generate (generate)
> import Crypto.PubKey.ECC.Types (getCurveByName, SEC_p256k1)
> let msg = "hello world" :: ByteString
> let secp256k1 = getCurveByName SEC_p256k1
> (pubKey, privKey) <- generate secp256k1
> sig <- sign privKey SHA3_256 msg
> verify SHA3_256 pubKey sig msg
True</code></pre>
If you're interested, here's a secp256k1 implementation (underlying elliptical curve cryptography) in pure Haskell:<p><a href="https://github.com/wyc/haschain/blob/master/Secp256K1.hs" rel="nofollow">https://github.com/wyc/haschain/blob/master/Secp256K1.hs</a><p>Should probably wrap it into a Group or something. Of course it's not secure, just for fun.
Another well documented blockchain implementation in Haskell: <a href="http://www.michaelburge.us/2017/08/17/rolling-your-own-blockchain.html" rel="nofollow">http://www.michaelburge.us/2017/08/17/rolling-your-own-block...</a>