Skip to content

Commit

Permalink
Add RIPEMD160 hashing function
Browse files Browse the repository at this point in the history
  • Loading branch information
paluh committed May 31, 2024
1 parent c064808 commit 56d1af8
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
4 changes: 4 additions & 0 deletions cardano-crypto-class/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog for `cardano-crypto-class`

## 2.1.5.0
* Add `RIMPEMD160` hashing function using `cryptonite` library
[#480](https://github.com/input-output-hk/cardano-base/pull/480)

## 2.1.2.0

* Included bindings to `blst` library to enable operations over curve BLS12-381
Expand Down
3 changes: 2 additions & 1 deletion cardano-crypto-class/cardano-crypto-class.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 2.2
name: cardano-crypto-class
version: 2.1.4.0
version: 2.1.5.0
synopsis:
Type classes abstracting over cryptography primitives for Cardano

Expand Down Expand Up @@ -52,6 +52,7 @@ library
Cardano.Crypto.Hash.Class
Cardano.Crypto.Hash.Keccak256
Cardano.Crypto.Hash.NeverUsed
Cardano.Crypto.Hash.RIPEMD160
Cardano.Crypto.Hash.SHA256
Cardano.Crypto.Hash.SHA3_256
Cardano.Crypto.Hash.Short
Expand Down
23 changes: 23 additions & 0 deletions cardano-crypto-class/src/Cardano/Crypto/Hash/RIPEMD160.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{-# 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 "cryptonite" Crypto.Hash as H
import qualified Data.ByteArray as BA

data RIPEMD160

instance HashAlgorithm RIPEMD160 where
type SizeHash RIPEMD160 = 20
hashAlgorithmName _ = "RIPEMD160"
digest _ = convert . H.hash

convert :: H.Digest H.RIPEMD160 -> ByteString
convert = BA.convert

0 comments on commit 56d1af8

Please sign in to comment.