amazonka-core-2.0: Core data types and functionality for Amazonka libraries.
Copyright(c) 2013-2023 Brendan Hay
LicenseMozilla Public License, v. 2.0.
MaintainerBrendan Hay <brendan.g.hay+amazonka@gmail.com>
Stabilityprovisional
Portabilitynon-portable (GHC extensions)
Safe HaskellSafe-Inferred
LanguageHaskell2010

Amazonka.Crypto

Description

 
Synopsis

HMAC

Hashing

hash :: (ByteArrayAccess ba, HashAlgorithm a) => ba -> Digest a #

Hash a strict bytestring into a digest.

sinkSHA256 :: Monad m => ConduitM ByteString o m (Digest SHA256) Source #

Incrementally calculate a SHA256 Digest.

sinkMD5 :: Monad m => ConduitM ByteString o m (Digest MD5) Source #

Incrementally calculate a MD5 Digest.

Re-exported

class HashAlgorithm a #

Class representing hashing algorithms.

The interface presented here is update in place and lowlevel. the Hash module takes care of hidding the mutable interface properly.

Instances

Instances details
HashAlgorithm Blake2b_160 
Instance details

Defined in Crypto.Hash.Blake2b

HashAlgorithm Blake2b_224 
Instance details

Defined in Crypto.Hash.Blake2b

HashAlgorithm Blake2b_256 
Instance details

Defined in Crypto.Hash.Blake2b

HashAlgorithm Blake2b_384 
Instance details

Defined in Crypto.Hash.Blake2b

HashAlgorithm Blake2b_512 
Instance details

Defined in Crypto.Hash.Blake2b

HashAlgorithm Blake2bp_512 
Instance details

Defined in Crypto.Hash.Blake2bp

HashAlgorithm Blake2s_160 
Instance details

Defined in Crypto.Hash.Blake2s

HashAlgorithm Blake2s_224 
Instance details

Defined in Crypto.Hash.Blake2s

HashAlgorithm Blake2s_256 
Instance details

Defined in Crypto.Hash.Blake2s

HashAlgorithm Blake2sp_224 
Instance details

Defined in Crypto.Hash.Blake2sp

HashAlgorithm Blake2sp_256 
Instance details

Defined in Crypto.Hash.Blake2sp

HashAlgorithm Keccak_224 
Instance details

Defined in Crypto.Hash.Keccak

HashAlgorithm Keccak_256 
Instance details

Defined in Crypto.Hash.Keccak

HashAlgorithm Keccak_384 
Instance details

Defined in Crypto.Hash.Keccak

HashAlgorithm Keccak_512 
Instance details

Defined in Crypto.Hash.Keccak

HashAlgorithm MD2 
Instance details

Defined in Crypto.Hash.MD2

Associated Types

type HashBlockSize MD2 :: Nat #

type HashDigestSize MD2 :: Nat #

type HashInternalContextSize MD2 :: Nat #

HashAlgorithm MD4 
Instance details

Defined in Crypto.Hash.MD4

Associated Types

type HashBlockSize MD4 :: Nat #

type HashDigestSize MD4 :: Nat #

type HashInternalContextSize MD4 :: Nat #

HashAlgorithm MD5 
Instance details

Defined in Crypto.Hash.MD5

Associated Types

type HashBlockSize MD5 :: Nat #

type HashDigestSize MD5 :: Nat #

type HashInternalContextSize MD5 :: Nat #

HashAlgorithm RIPEMD160 
Instance details

Defined in Crypto.Hash.RIPEMD160

HashAlgorithm SHA1 
Instance details

Defined in Crypto.Hash.SHA1

HashAlgorithm SHA224 
Instance details

Defined in Crypto.Hash.SHA224

HashAlgorithm SHA256 
Instance details

Defined in Crypto.Hash.SHA256

HashAlgorithm SHA3_224 
Instance details

Defined in Crypto.Hash.SHA3

HashAlgorithm SHA3_256 
Instance details

Defined in Crypto.Hash.SHA3

HashAlgorithm SHA3_384 
Instance details

Defined in Crypto.Hash.SHA3

HashAlgorithm SHA3_512 
Instance details

Defined in Crypto.Hash.SHA3

HashAlgorithm SHA384 
Instance details

Defined in Crypto.Hash.SHA384

HashAlgorithm SHA512 
Instance details

Defined in Crypto.Hash.SHA512

HashAlgorithm SHA512t_224 
Instance details

Defined in Crypto.Hash.SHA512t

HashAlgorithm SHA512t_256 
Instance details

Defined in Crypto.Hash.SHA512t

HashAlgorithm Skein256_224 
Instance details

Defined in Crypto.Hash.Skein256

HashAlgorithm Skein256_256 
Instance details

Defined in Crypto.Hash.Skein256

HashAlgorithm Skein512_224 
Instance details

Defined in Crypto.Hash.Skein512

HashAlgorithm Skein512_256 
Instance details

Defined in Crypto.Hash.Skein512

HashAlgorithm Skein512_384 
Instance details

Defined in Crypto.Hash.Skein512

HashAlgorithm Skein512_512 
Instance details

Defined in Crypto.Hash.Skein512

HashAlgorithm Tiger 
Instance details

Defined in Crypto.Hash.Tiger

HashAlgorithm Whirlpool 
Instance details

Defined in Crypto.Hash.Whirlpool

(IsDivisibleBy8 bitlen, KnownNat bitlen, IsAtLeast bitlen 8, IsAtMost bitlen 512) => HashAlgorithm (Blake2b bitlen) 
Instance details

Defined in Crypto.Hash.Blake2

Associated Types

type HashBlockSize (Blake2b bitlen) :: Nat #

type HashDigestSize (Blake2b bitlen) :: Nat #

type HashInternalContextSize (Blake2b bitlen) :: Nat #

Methods

hashBlockSize :: Blake2b bitlen -> Int #

hashDigestSize :: Blake2b bitlen -> Int #

hashInternalContextSize :: Blake2b bitlen -> Int #

hashInternalInit :: Ptr (Context (Blake2b bitlen)) -> IO () #

hashInternalUpdate :: Ptr (Context (Blake2b bitlen)) -> Ptr Word8 -> Word32 -> IO () #

hashInternalFinalize :: Ptr (Context (Blake2b bitlen)) -> Ptr (Digest (Blake2b bitlen)) -> IO () #

(IsDivisibleBy8 bitlen, KnownNat bitlen, IsAtLeast bitlen 8, IsAtMost bitlen 512) => HashAlgorithm (Blake2bp bitlen) 
Instance details

Defined in Crypto.Hash.Blake2

Associated Types

type HashBlockSize (Blake2bp bitlen) :: Nat #

type HashDigestSize (Blake2bp bitlen) :: Nat #

type HashInternalContextSize (Blake2bp bitlen) :: Nat #

Methods

hashBlockSize :: Blake2bp bitlen -> Int #

hashDigestSize :: Blake2bp bitlen -> Int #

hashInternalContextSize :: Blake2bp bitlen -> Int #

hashInternalInit :: Ptr (Context (Blake2bp bitlen)) -> IO () #

hashInternalUpdate :: Ptr (Context (Blake2bp bitlen)) -> Ptr Word8 -> Word32 -> IO () #

hashInternalFinalize :: Ptr (Context (Blake2bp bitlen)) -> Ptr (Digest (Blake2bp bitlen)) -> IO () #

(IsDivisibleBy8 bitlen, KnownNat bitlen, IsAtLeast bitlen 8, IsAtMost bitlen 256) => HashAlgorithm (Blake2s bitlen) 
Instance details

Defined in Crypto.Hash.Blake2

Associated Types

type HashBlockSize (Blake2s bitlen) :: Nat #

type HashDigestSize (Blake2s bitlen) :: Nat #

type HashInternalContextSize (Blake2s bitlen) :: Nat #

Methods

hashBlockSize :: Blake2s bitlen -> Int #

hashDigestSize :: Blake2s bitlen -> Int #

hashInternalContextSize :: Blake2s bitlen -> Int #

hashInternalInit :: Ptr (Context (Blake2s bitlen)) -> IO () #

hashInternalUpdate :: Ptr (Context (Blake2s bitlen)) -> Ptr Word8 -> Word32 -> IO () #

hashInternalFinalize :: Ptr (Context (Blake2s bitlen)) -> Ptr (Digest (Blake2s bitlen)) -> IO () #

(IsDivisibleBy8 bitlen, KnownNat bitlen, IsAtLeast bitlen 8, IsAtMost bitlen 256) => HashAlgorithm (Blake2sp bitlen) 
Instance details

Defined in Crypto.Hash.Blake2

Associated Types

type HashBlockSize (Blake2sp bitlen) :: Nat #

type HashDigestSize (Blake2sp bitlen) :: Nat #

type HashInternalContextSize (Blake2sp bitlen) :: Nat #

Methods

hashBlockSize :: Blake2sp bitlen -> Int #

hashDigestSize :: Blake2sp bitlen -> Int #

hashInternalContextSize :: Blake2sp bitlen -> Int #

hashInternalInit :: Ptr (Context (Blake2sp bitlen)) -> IO () #

hashInternalUpdate :: Ptr (Context (Blake2sp bitlen)) -> Ptr Word8 -> Word32 -> IO () #

hashInternalFinalize :: Ptr (Context (Blake2sp bitlen)) -> Ptr (Digest (Blake2sp bitlen)) -> IO () #

KnownNat bitlen => HashAlgorithm (SHAKE128 bitlen) 
Instance details

Defined in Crypto.Hash.SHAKE

Associated Types

type HashBlockSize (SHAKE128 bitlen) :: Nat #

type HashDigestSize (SHAKE128 bitlen) :: Nat #

type HashInternalContextSize (SHAKE128 bitlen) :: Nat #

Methods

hashBlockSize :: SHAKE128 bitlen -> Int #

hashDigestSize :: SHAKE128 bitlen -> Int #

hashInternalContextSize :: SHAKE128 bitlen -> Int #

hashInternalInit :: Ptr (Context (SHAKE128 bitlen)) -> IO () #

hashInternalUpdate :: Ptr (Context (SHAKE128 bitlen)) -> Ptr Word8 -> Word32 -> IO () #

hashInternalFinalize :: Ptr (Context (SHAKE128 bitlen)) -> Ptr (Digest (SHAKE128 bitlen)) -> IO () #

KnownNat bitlen => HashAlgorithm (SHAKE256 bitlen) 
Instance details

Defined in Crypto.Hash.SHAKE

Associated Types

type HashBlockSize (SHAKE256 bitlen) :: Nat #

type HashDigestSize (SHAKE256 bitlen) :: Nat #

type HashInternalContextSize (SHAKE256 bitlen) :: Nat #

Methods

hashBlockSize :: SHAKE256 bitlen -> Int #

hashDigestSize :: SHAKE256 bitlen -> Int #

hashInternalContextSize :: SHAKE256 bitlen -> Int #

hashInternalInit :: Ptr (Context (SHAKE256 bitlen)) -> IO () #

hashInternalUpdate :: Ptr (Context (SHAKE256 bitlen)) -> Ptr Word8 -> Word32 -> IO () #

hashInternalFinalize :: Ptr (Context (SHAKE256 bitlen)) -> Ptr (Digest (SHAKE256 bitlen)) -> IO () #

data Digest a #

Represent a digest for a given hash algorithm.

This type is an instance of ByteArrayAccess from package memory. Module Data.ByteArray provides many primitives to work with those values including conversion to other types.

Creating a digest from a bytearray is also possible with function digestFromByteString.

Instances

Instances details
ToText (Digest a) Source # 
Instance details

Defined in Amazonka.Data.Text

Methods

toText :: Digest a -> Text Source #

Data a => Data (Digest a) 
Instance details

Defined in Crypto.Hash.Types

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Digest a -> c (Digest a) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Digest a) #

toConstr :: Digest a -> Constr #

dataTypeOf :: Digest a -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Digest a)) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Digest a)) #

gmapT :: (forall b. Data b => b -> b) -> Digest a -> Digest a #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Digest a -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Digest a -> r #

gmapQ :: (forall d. Data d => d -> u) -> Digest a -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Digest a -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Digest a -> m (Digest a) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Digest a -> m (Digest a) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Digest a -> m (Digest a) #

HashAlgorithm a => Read (Digest a) 
Instance details

Defined in Crypto.Hash.Types

Show (Digest a) 
Instance details

Defined in Crypto.Hash.Types

Methods

showsPrec :: Int -> Digest a -> ShowS #

show :: Digest a -> String #

showList :: [Digest a] -> ShowS #

NFData (Digest a) 
Instance details

Defined in Crypto.Hash.Types

Methods

rnf :: Digest a -> () #

Eq (Digest a) 
Instance details

Defined in Crypto.Hash.Types

Methods

(==) :: Digest a -> Digest a -> Bool #

(/=) :: Digest a -> Digest a -> Bool #

Ord (Digest a) 
Instance details

Defined in Crypto.Hash.Types

Methods

compare :: Digest a -> Digest a -> Ordering #

(<) :: Digest a -> Digest a -> Bool #

(<=) :: Digest a -> Digest a -> Bool #

(>) :: Digest a -> Digest a -> Bool #

(>=) :: Digest a -> Digest a -> Bool #

max :: Digest a -> Digest a -> Digest a #

min :: Digest a -> Digest a -> Digest a #

ByteArrayAccess (Digest a) 
Instance details

Defined in Crypto.Hash.Types

Methods

length :: Digest a -> Int #

withByteArray :: Digest a -> (Ptr p -> IO a0) -> IO a0 #

copyByteArrayToPtr :: Digest a -> Ptr p -> IO () #

data SHA256 #

SHA256 cryptographic hash algorithm

Instances

Instances details
Data SHA256 
Instance details

Defined in Crypto.Hash.SHA256

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> SHA256 -> c SHA256 #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c SHA256 #

toConstr :: SHA256 -> Constr #

dataTypeOf :: SHA256 -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c SHA256) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SHA256) #

gmapT :: (forall b. Data b => b -> b) -> SHA256 -> SHA256 #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> SHA256 -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> SHA256 -> r #

gmapQ :: (forall d. Data d => d -> u) -> SHA256 -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> SHA256 -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> SHA256 -> m SHA256 #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> SHA256 -> m SHA256 #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> SHA256 -> m SHA256 #

Show SHA256 
Instance details

Defined in Crypto.Hash.SHA256

HashAlgorithm SHA256 
Instance details

Defined in Crypto.Hash.SHA256

HashAlgorithmPrefix SHA256 
Instance details

Defined in Crypto.Hash.SHA256

type HashBlockSize SHA256 
Instance details

Defined in Crypto.Hash.SHA256

type HashDigestSize SHA256 
Instance details

Defined in Crypto.Hash.SHA256

type HashInternalContextSize SHA256 
Instance details

Defined in Crypto.Hash.SHA256

data MD5 #

MD5 cryptographic hash algorithm

Instances

Instances details
Data MD5 
Instance details

Defined in Crypto.Hash.MD5

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> MD5 -> c MD5 #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c MD5 #

toConstr :: MD5 -> Constr #

dataTypeOf :: MD5 -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c MD5) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c MD5) #

gmapT :: (forall b. Data b => b -> b) -> MD5 -> MD5 #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> MD5 -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> MD5 -> r #

gmapQ :: (forall d. Data d => d -> u) -> MD5 -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> MD5 -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> MD5 -> m MD5 #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> MD5 -> m MD5 #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> MD5 -> m MD5 #

Show MD5 
Instance details

Defined in Crypto.Hash.MD5

Methods

showsPrec :: Int -> MD5 -> ShowS #

show :: MD5 -> String #

showList :: [MD5] -> ShowS #

HashAlgorithm MD5 
Instance details

Defined in Crypto.Hash.MD5

Associated Types

type HashBlockSize MD5 :: Nat #

type HashDigestSize MD5 :: Nat #

type HashInternalContextSize MD5 :: Nat #

HashAlgorithmPrefix MD5 
Instance details

Defined in Crypto.Hash.MD5

type HashBlockSize MD5 
Instance details

Defined in Crypto.Hash.MD5

type HashBlockSize MD5 = 64
type HashDigestSize MD5 
Instance details

Defined in Crypto.Hash.MD5

type HashInternalContextSize MD5 
Instance details

Defined in Crypto.Hash.MD5