{-# LANGUAGE DataKinds #-}
{-# LANGUAGE PackageImports #-}
{-# LANGUAGE TypeFamilies #-}

-- | Implementation of the RIPEMD-160 hashing algorithm.
module Cardano.Crypto.Hash.RIPEMD160 (
  RIPEMD160,
)
where

import Cardano.Crypto.Hash.Class
import qualified Data.ByteArray as BA
import qualified "crypton" Crypto.Hash as H

data RIPEMD160

instance HashAlgorithm RIPEMD160 where
  type SizeHash RIPEMD160 = 20
  hashAlgorithmName :: forall (proxy :: * -> *). proxy RIPEMD160 -> String
hashAlgorithmName proxy RIPEMD160
_ = String
"RIPEMD160"
  digest :: forall (proxy :: * -> *).
proxy RIPEMD160 -> ByteString -> ByteString
digest proxy RIPEMD160
_ = Digest RIPEMD160 -> ByteString
convert forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall ba a.
(ByteArrayAccess ba, HashAlgorithm a) =>
ba -> Digest a
H.hash

convert :: H.Digest H.RIPEMD160 -> ByteString
convert :: Digest RIPEMD160 -> ByteString
convert = forall bin bout.
(ByteArrayAccess bin, ByteArray bout) =>
bin -> bout
BA.convert