amazonka-core-1.5.0: Core data types and functionality for Amazonka libraries.

Copyright(c) 2013-2017 Brendan Hay
LicenseMozilla Public License, v. 2.0.
MaintainerBrendan Hay <brendan.g.hay+amazonka@gmail.com>
Stabilityprovisional
Portabilitynon-portable (GHC extensions)
Safe HaskellNone
LanguageHaskell2010

Network.AWS.Data.Crypto

Contents

Description

 

Synopsis

Conversion

Algorithms

hmacSHA1 :: (ByteArrayAccess a, ByteArray b) => a -> b -> HMAC SHA1 Source #

Apply an HMAC sha1 with the given secret to the given value.

Contexts

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

Hash a strict bytestring into a digest.

hashlazy :: HashAlgorithm a => ByteString -> Digest a #

Hash a lazy bytestring into a digest.

hashInit :: HashAlgorithm a => Context a #

Initialize a new context for this hash algorithm

hashUpdate :: (ByteArrayAccess ba, HashAlgorithm a) => Context a -> ba -> Context a #

run hashUpdates on one single bytestring and return the updated context.

hashFinalize :: HashAlgorithm a => Context a -> Digest a #

Finalize a context and return a digest.

Re-exported

data HMAC a :: * -> * #

Represent an HMAC that is a phantom type with the hash used to produce the mac.

The Eq instance is constant time.

Instances

Eq (HMAC a) 

Methods

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

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

ByteArrayAccess (HMAC a) 

Methods

length :: HMAC a -> Int #

withByteArray :: HMAC a -> (Ptr p -> IO a) -> IO a #

data Digest a :: * -> * #

Represent a digest for a given hash algorithm.

Instances

Eq (Digest a) 

Methods

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

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

Ord (Digest a) 

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 #

Show (Digest a) 

Methods

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

show :: Digest a -> String #

showList :: [Digest a] -> ShowS #

ByteArrayAccess (Digest a) 

Methods

length :: Digest a -> Int #

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

NFData (Digest a) 

Methods

rnf :: Digest a -> () #

ToText (Digest a) Source # 

Methods

toText :: Digest a -> Text Source #

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

HashAlgorithm Blake2b_160 
HashAlgorithm Blake2b_224 
HashAlgorithm Blake2b_256 
HashAlgorithm Blake2b_384 
HashAlgorithm Blake2b_512 
HashAlgorithm Blake2bp_512 
HashAlgorithm Blake2s_160 
HashAlgorithm Blake2s_224 
HashAlgorithm Blake2s_256 
HashAlgorithm Blake2sp_224 
HashAlgorithm Blake2sp_256 
HashAlgorithm Keccak_224 
HashAlgorithm Keccak_256 
HashAlgorithm Keccak_384 
HashAlgorithm Keccak_512 
HashAlgorithm MD2 
HashAlgorithm MD4 
HashAlgorithm MD5 
HashAlgorithm RIPEMD160 
HashAlgorithm SHA1 
HashAlgorithm SHA224 
HashAlgorithm SHA256 
HashAlgorithm SHA3_224 
HashAlgorithm SHA3_256 
HashAlgorithm SHA3_384 
HashAlgorithm SHA3_512 
HashAlgorithm SHA384 
HashAlgorithm SHA512 
HashAlgorithm SHA512t_224 
HashAlgorithm SHA512t_256 
HashAlgorithm Skein256_224 
HashAlgorithm Skein256_256 
HashAlgorithm Skein512_224 
HashAlgorithm Skein512_256 
HashAlgorithm Skein512_384 
HashAlgorithm Skein512_512 
HashAlgorithm Tiger 
HashAlgorithm Whirlpool 
(IsDivisibleBy8 bitlen, KnownNat bitlen, IsAtLeast bitlen 8, IsAtMost bitlen 256) => HashAlgorithm (Blake2s bitlen) 

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 512) => HashAlgorithm (Blake2b bitlen) 

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 256) => HashAlgorithm (Blake2sp bitlen) 

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 () #

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

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) => HashAlgorithm (SHAKE128 bitlen) 

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 () #

(IsDivisibleBy8 bitlen, KnownNat bitlen) => HashAlgorithm (SHAKE256 bitlen) 

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 SHA256 :: * #

SHA256 cryptographic hash algorithm

Constructors

SHA256 

Instances

Data 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 :: (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 
HashAlgorithm SHA256 
type HashInternalContextSize SHA256 
type HashDigestSize SHA256 
type HashBlockSize SHA256 

data MD5 :: * #

MD5 cryptographic hash algorithm

Constructors

MD5 

Instances

Data 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 :: (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 

Methods

showsPrec :: Int -> MD5 -> ShowS #

show :: MD5 -> String #

showList :: [MD5] -> ShowS #

HashAlgorithm MD5 
type HashInternalContextSize MD5 
type HashDigestSize MD5 
type HashBlockSize MD5 
type HashBlockSize MD5 = 64

data Base :: * #

Different bases that can be used

See RFC4648 for details. In particular, Base64 can be standard or URL-safe. URL-safe encoding is often used in other specifications without padding characters.

Constructors

Base16

similar to hexadecimal

Base32 
Base64

standard Base64

Base64URLUnpadded

unpadded URL-safe Base64

Base64OpenBSD

Base64 as used in OpenBSD password encoding (such as bcrypt)

Instances

Eq Base 

Methods

(==) :: Base -> Base -> Bool #

(/=) :: Base -> Base -> Bool #

Show Base 

Methods

showsPrec :: Int -> Base -> ShowS #

show :: Base -> String #

showList :: [Base] -> ShowS #