From 45a29b37173ab724d8b90af7e0b1a9fda3acbeb2 Mon Sep 17 00:00:00 2001 From: Benjamin Barenblat Date: Sat, 27 Jan 2018 17:05:58 -0500 Subject: Data.Digest: Switch back to EVP Use the finalizer techniques demonstrated in 4e56c79b907da4a4654e5278bdcf94b08480a426 to safely allocate `EVP_MD_CTX` on the Haskell heap. This allows us to return to the high-level EVP API, eliminating much boilerplate code. --- src/Data/Digest/Md5.hs | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/Data/Digest/Md5.hs (limited to 'src/Data/Digest/Md5.hs') diff --git a/src/Data/Digest/Md5.hs b/src/Data/Digest/Md5.hs new file mode 100644 index 0000000..194633b --- /dev/null +++ b/src/Data/Digest/Md5.hs @@ -0,0 +1,12 @@ +module Data.Digest.Md5 + ( md5 + ) where + +import Data.ByteString.Lazy (ByteString) + +import Data.Digest.Internal + +foreign import ccall "openssl/digest.h EVP_md5" evpMd5 :: Algo + +md5 :: ByteString -> Digest +md5 = hash evpMd5 -- cgit v1.2.3