module Botan.Hash.RIPEMD
( RIPEMD160(..)
, RIPEMD160Digest(..)
, ripemd160
, ripemd160Lazy
) where
import qualified Data.ByteString as ByteString
import qualified Data.ByteString.Lazy as Lazy
import qualified Data.Text as Text
import qualified Botan.Hash as Botan
import qualified Botan.Utility as Botan
import Botan.Hash.Class
import Botan.Prelude
data RIPEMD160
newtype instance Digest RIPEMD160 = RIPEMD160Digest
{ Digest RIPEMD160 -> ByteString
getRIPEMD160ByteString :: ByteString }
deriving newtype (Digest RIPEMD160 -> Digest RIPEMD160 -> Bool
(Digest RIPEMD160 -> Digest RIPEMD160 -> Bool)
-> (Digest RIPEMD160 -> Digest RIPEMD160 -> Bool)
-> Eq (Digest RIPEMD160)
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Digest RIPEMD160 -> Digest RIPEMD160 -> Bool
== :: Digest RIPEMD160 -> Digest RIPEMD160 -> Bool
$c/= :: Digest RIPEMD160 -> Digest RIPEMD160 -> Bool
/= :: Digest RIPEMD160 -> Digest RIPEMD160 -> Bool
Eq, Eq (Digest RIPEMD160)
Eq (Digest RIPEMD160) =>
(Digest RIPEMD160 -> Digest RIPEMD160 -> Ordering)
-> (Digest RIPEMD160 -> Digest RIPEMD160 -> Bool)
-> (Digest RIPEMD160 -> Digest RIPEMD160 -> Bool)
-> (Digest RIPEMD160 -> Digest RIPEMD160 -> Bool)
-> (Digest RIPEMD160 -> Digest RIPEMD160 -> Bool)
-> (Digest RIPEMD160 -> Digest RIPEMD160 -> Digest RIPEMD160)
-> (Digest RIPEMD160 -> Digest RIPEMD160 -> Digest RIPEMD160)
-> Ord (Digest RIPEMD160)
Digest RIPEMD160 -> Digest RIPEMD160 -> Bool
Digest RIPEMD160 -> Digest RIPEMD160 -> Ordering
Digest RIPEMD160 -> Digest RIPEMD160 -> Digest RIPEMD160
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: Digest RIPEMD160 -> Digest RIPEMD160 -> Ordering
compare :: Digest RIPEMD160 -> Digest RIPEMD160 -> Ordering
$c< :: Digest RIPEMD160 -> Digest RIPEMD160 -> Bool
< :: Digest RIPEMD160 -> Digest RIPEMD160 -> Bool
$c<= :: Digest RIPEMD160 -> Digest RIPEMD160 -> Bool
<= :: Digest RIPEMD160 -> Digest RIPEMD160 -> Bool
$c> :: Digest RIPEMD160 -> Digest RIPEMD160 -> Bool
> :: Digest RIPEMD160 -> Digest RIPEMD160 -> Bool
$c>= :: Digest RIPEMD160 -> Digest RIPEMD160 -> Bool
>= :: Digest RIPEMD160 -> Digest RIPEMD160 -> Bool
$cmax :: Digest RIPEMD160 -> Digest RIPEMD160 -> Digest RIPEMD160
max :: Digest RIPEMD160 -> Digest RIPEMD160 -> Digest RIPEMD160
$cmin :: Digest RIPEMD160 -> Digest RIPEMD160 -> Digest RIPEMD160
min :: Digest RIPEMD160 -> Digest RIPEMD160 -> Digest RIPEMD160
Ord)
type RIPEMD160Digest = Digest RIPEMD160
instance Show (Digest RIPEMD160) where
show :: Digest RIPEMD160 -> String
show :: Digest RIPEMD160 -> String
show (RIPEMD160Digest ByteString
bytes) = Text -> String
Text.unpack (Text -> String) -> Text -> String
forall a b. (a -> b) -> a -> b
$ ByteString -> HexCase -> Text
Botan.hexEncode ByteString
bytes HexCase
Botan.Lower
instance Hash RIPEMD160 where
hash :: ByteString -> Digest RIPEMD160
hash :: ByteString -> Digest RIPEMD160
hash = ByteString -> Digest RIPEMD160
RIPEMD160Digest (ByteString -> Digest RIPEMD160)
-> (ByteString -> ByteString) -> ByteString -> Digest RIPEMD160
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Hash -> ByteString -> ByteString
Botan.hash Hash
Botan.ripemd160
instance IncrementalHash RIPEMD160 where
hashLazy :: Lazy.ByteString -> Digest RIPEMD160
hashLazy :: ByteString -> Digest RIPEMD160
hashLazy = ByteString -> Digest RIPEMD160
RIPEMD160Digest (ByteString -> Digest RIPEMD160)
-> (ByteString -> ByteString) -> ByteString -> Digest RIPEMD160
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Hash -> ByteString -> ByteString
Botan.hashLazy Hash
Botan.ripemd160
ripemd160 :: ByteString -> RIPEMD160Digest
ripemd160 :: ByteString -> Digest RIPEMD160
ripemd160 = ByteString -> Digest RIPEMD160
forall hash. Hash hash => ByteString -> Digest hash
hash
ripemd160Lazy :: Lazy.ByteString -> RIPEMD160Digest
ripemd160Lazy :: ByteString -> Digest RIPEMD160
ripemd160Lazy = ByteString -> Digest RIPEMD160
forall hash. IncrementalHash hash => ByteString -> Digest hash
hashLazy