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