module Botan.Hash.GOST
( GOST_34_11(..)
, GOST_34_11Digest(..)
, gost_34_11
, gost_34_11Lazy
) 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 GOST_34_11
newtype instance Digest GOST_34_11 = GOST_34_11Digest
{ Digest GOST_34_11 -> ByteString
getGOST_34_11ByteString :: ByteString }
deriving newtype (Digest GOST_34_11 -> Digest GOST_34_11 -> Bool
(Digest GOST_34_11 -> Digest GOST_34_11 -> Bool)
-> (Digest GOST_34_11 -> Digest GOST_34_11 -> Bool)
-> Eq (Digest GOST_34_11)
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Digest GOST_34_11 -> Digest GOST_34_11 -> Bool
== :: Digest GOST_34_11 -> Digest GOST_34_11 -> Bool
$c/= :: Digest GOST_34_11 -> Digest GOST_34_11 -> Bool
/= :: Digest GOST_34_11 -> Digest GOST_34_11 -> Bool
Eq, Eq (Digest GOST_34_11)
Eq (Digest GOST_34_11) =>
(Digest GOST_34_11 -> Digest GOST_34_11 -> Ordering)
-> (Digest GOST_34_11 -> Digest GOST_34_11 -> Bool)
-> (Digest GOST_34_11 -> Digest GOST_34_11 -> Bool)
-> (Digest GOST_34_11 -> Digest GOST_34_11 -> Bool)
-> (Digest GOST_34_11 -> Digest GOST_34_11 -> Bool)
-> (Digest GOST_34_11 -> Digest GOST_34_11 -> Digest GOST_34_11)
-> (Digest GOST_34_11 -> Digest GOST_34_11 -> Digest GOST_34_11)
-> Ord (Digest GOST_34_11)
Digest GOST_34_11 -> Digest GOST_34_11 -> Bool
Digest GOST_34_11 -> Digest GOST_34_11 -> Ordering
Digest GOST_34_11 -> Digest GOST_34_11 -> Digest GOST_34_11
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 GOST_34_11 -> Digest GOST_34_11 -> Ordering
compare :: Digest GOST_34_11 -> Digest GOST_34_11 -> Ordering
$c< :: Digest GOST_34_11 -> Digest GOST_34_11 -> Bool
< :: Digest GOST_34_11 -> Digest GOST_34_11 -> Bool
$c<= :: Digest GOST_34_11 -> Digest GOST_34_11 -> Bool
<= :: Digest GOST_34_11 -> Digest GOST_34_11 -> Bool
$c> :: Digest GOST_34_11 -> Digest GOST_34_11 -> Bool
> :: Digest GOST_34_11 -> Digest GOST_34_11 -> Bool
$c>= :: Digest GOST_34_11 -> Digest GOST_34_11 -> Bool
>= :: Digest GOST_34_11 -> Digest GOST_34_11 -> Bool
$cmax :: Digest GOST_34_11 -> Digest GOST_34_11 -> Digest GOST_34_11
max :: Digest GOST_34_11 -> Digest GOST_34_11 -> Digest GOST_34_11
$cmin :: Digest GOST_34_11 -> Digest GOST_34_11 -> Digest GOST_34_11
min :: Digest GOST_34_11 -> Digest GOST_34_11 -> Digest GOST_34_11
Ord)
type GOST_34_11Digest = Digest GOST_34_11
instance Show (Digest GOST_34_11) where
show :: Digest GOST_34_11 -> String
show :: Digest GOST_34_11 -> String
show (GOST_34_11Digest 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 GOST_34_11 where
hash :: ByteString -> Digest GOST_34_11
hash :: ByteString -> Digest GOST_34_11
hash = ByteString -> Digest GOST_34_11
GOST_34_11Digest (ByteString -> Digest GOST_34_11)
-> (ByteString -> ByteString) -> ByteString -> Digest GOST_34_11
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Hash -> ByteString -> ByteString
Botan.hash Hash
Botan.gost_34_11
instance IncrementalHash GOST_34_11 where
hashLazy :: Lazy.ByteString -> Digest GOST_34_11
hashLazy :: ByteString -> Digest GOST_34_11
hashLazy = ByteString -> Digest GOST_34_11
GOST_34_11Digest (ByteString -> Digest GOST_34_11)
-> (ByteString -> ByteString) -> ByteString -> Digest GOST_34_11
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Hash -> ByteString -> ByteString
Botan.hashLazy Hash
Botan.gost_34_11
gost_34_11 :: ByteString -> GOST_34_11Digest
gost_34_11 :: ByteString -> Digest GOST_34_11
gost_34_11 = ByteString -> Digest GOST_34_11
forall hash. Hash hash => ByteString -> Digest hash
hash
gost_34_11Lazy :: Lazy.ByteString -> GOST_34_11Digest
gost_34_11Lazy :: ByteString -> Digest GOST_34_11
gost_34_11Lazy = ByteString -> Digest GOST_34_11
forall hash. IncrementalHash hash => ByteString -> Digest hash
hashLazy