Skip to content

Commit 07c54e4

Browse files
committed
Add RIPEMD160 hashing function
1 parent 02f4a07 commit 07c54e4

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

cardano-crypto-class/cardano-crypto-class.cabal

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ library
5252
Cardano.Crypto.Hash.Class
5353
Cardano.Crypto.Hash.Keccak256
5454
Cardano.Crypto.Hash.NeverUsed
55+
Cardano.Crypto.Hash.RIPEMD160
5556
Cardano.Crypto.Hash.SHA256
5657
Cardano.Crypto.Hash.SHA3_256
5758
Cardano.Crypto.Hash.Short
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{-# LANGUAGE DataKinds #-}
2+
{-# LANGUAGE PackageImports #-}
3+
{-# LANGUAGE TypeFamilies #-}
4+
5+
-- | Implementation of the RIPEMD-160 hashing algorithm.
6+
module Cardano.Crypto.Hash.RIPEMD160
7+
( RIPEMD160
8+
)
9+
where
10+
import Cardano.Crypto.Hash.Class
11+
import qualified "cryptonite" Crypto.Hash as H
12+
import qualified Data.ByteArray as BA
13+
14+
data RIPEMD160
15+
16+
instance HashAlgorithm RIPEMD160 where
17+
type SizeHash RIPEMD160 = 20
18+
hashAlgorithmName _ = "RIPEMD160"
19+
digest _ = convert . H.hash
20+
21+
convert :: H.Digest H.RIPEMD160 -> ByteString
22+
convert = BA.convert
23+

0 commit comments

Comments
 (0)