yu-auth-0.1.1.10: Auth module for Yu.

Copyright(C) 2017-2018 Johann Lee <me@qinka.pro>
LicenseGPL-3
Maintainerme@qinka.pro
Stabilityexperimental
Portabilityunknown
Safe HaskellNone
LanguageHaskell2010

Yu.Auth.Core

Contents

Description

The collection of core method for authentication.

Synopsis

method for hash

These methods are used to generate the token to the hash and verify the token and hash.

If you want the generate the hash for "12345qwert", you should: > let hashStr = generateHash SHA512 "12345qwert" When you verify the hash, you need to > let isOk = verifyHash SHA512 "xxxxx" "12345qwert"

generateHash Source #

Arguments

:: HashAlgorithm a 
=> a

Hash algorithm

-> ByteString

The hash of key

-> ByteString

Hash string

generate hash for the key

verifyHash Source #

Arguments

:: HashAlgorithm a 
=> a

Hash algorithm

-> ByteString

Hash for key

-> ByteString

Hash string

-> Bool 

verify the hash and key

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

Hash a strict bytestring into a digest.

hash algorithm

data SHA512 :: * #

SHA512 cryptographic hash algorithm

Constructors

SHA512 

Instances

Data SHA512 

Methods

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

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

toConstr :: SHA512 -> Constr #

dataTypeOf :: SHA512 -> DataType #

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

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

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

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

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

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

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

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

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

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

Show SHA512 
HashAlgorithm SHA512 
type HashInternalContextSize SHA512 
type HashDigestSize SHA512 
type HashBlockSize SHA512 

data SHA384 :: * #

SHA384 cryptographic hash algorithm

Constructors

SHA384 

Instances

Data SHA384 

Methods

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

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

toConstr :: SHA384 -> Constr #

dataTypeOf :: SHA384 -> DataType #

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

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

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

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

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

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

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

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

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

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

Show SHA384 
HashAlgorithm SHA384 
type HashInternalContextSize SHA384 
type HashDigestSize SHA384 
type HashBlockSize SHA384 

data SHA3_512 :: * #

SHA3 (512 bits) cryptographic hash algorithm

Constructors

SHA3_512 

Instances

Data SHA3_512 

Methods

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

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

toConstr :: SHA3_512 -> Constr #

dataTypeOf :: SHA3_512 -> DataType #

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

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

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

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

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

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

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

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

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

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

Show SHA3_512 
HashAlgorithm SHA3_512 
type HashInternalContextSize SHA3_512 
type HashDigestSize SHA3_512 
type HashBlockSize SHA3_512 

data SHA3_384 :: * #

SHA3 (384 bits) cryptographic hash algorithm

Constructors

SHA3_384 

Instances

Data SHA3_384 

Methods

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

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

toConstr :: SHA3_384 -> Constr #

dataTypeOf :: SHA3_384 -> DataType #

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

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

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

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

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

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

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

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

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

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

Show SHA3_384 
HashAlgorithm SHA3_384 
type HashInternalContextSize SHA3_384 
type HashDigestSize SHA3_384 
type HashBlockSize SHA3_384 

data SHA3_256 :: * #

SHA3 (256 bits) cryptographic hash algorithm

Constructors

SHA3_256 

Instances

Data SHA3_256 

Methods

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

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

toConstr :: SHA3_256 -> Constr #

dataTypeOf :: SHA3_256 -> DataType #

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

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

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

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

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

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

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

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

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

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

Show SHA3_256 
HashAlgorithm SHA3_256 
type HashInternalContextSize SHA3_256 
type HashDigestSize SHA3_256 
type HashBlockSize SHA3_256 

data SHA3_224 :: * #

SHA3 (224 bits) cryptographic hash algorithm

Constructors

SHA3_224 

Instances

Data SHA3_224 

Methods

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

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

toConstr :: SHA3_224 -> Constr #

dataTypeOf :: SHA3_224 -> DataType #

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

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

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

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

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

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

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

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

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

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

Show SHA3_224 
HashAlgorithm SHA3_224 
type HashInternalContextSize SHA3_224 
type HashDigestSize SHA3_224 
type HashBlockSize SHA3_224 

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

SHA224 cryptographic hash algorithm

Constructors

SHA224 

Instances

Data SHA224 

Methods

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

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

toConstr :: SHA224 -> Constr #

dataTypeOf :: SHA224 -> DataType #

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

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

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

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

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

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

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

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

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

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

Show SHA224 
HashAlgorithm SHA224 
type HashInternalContextSize SHA224 
type HashDigestSize SHA224 
type HashBlockSize SHA224 

data SHA1 :: * #

SHA1 cryptographic hash algorithm

Constructors

SHA1 

Instances

Data SHA1 

Methods

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

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

toConstr :: SHA1 -> Constr #

dataTypeOf :: SHA1 -> DataType #

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

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

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

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

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

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

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

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

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

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

Show SHA1 

Methods

showsPrec :: Int -> SHA1 -> ShowS #

show :: SHA1 -> String #

showList :: [SHA1] -> ShowS #

HashAlgorithm SHA1 
type HashInternalContextSize SHA1 
type HashDigestSize SHA1 
type HashBlockSize SHA1 

data SHA512t_256 :: * #

SHA512t (256 bits) cryptographic hash algorithm

Constructors

SHA512t_256 

Instances

Data SHA512t_256 

Methods

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

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

toConstr :: SHA512t_256 -> Constr #

dataTypeOf :: SHA512t_256 -> DataType #

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

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

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

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

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

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

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

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

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

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

Show SHA512t_256 
HashAlgorithm SHA512t_256 
type HashInternalContextSize SHA512t_256 
type HashDigestSize SHA512t_256 
type HashBlockSize SHA512t_256 

data SHA512t_224 :: * #

SHA512t (224 bits) cryptographic hash algorithm

Constructors

SHA512t_224 

Instances

Data SHA512t_224 

Methods

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

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

toConstr :: SHA512t_224 -> Constr #

dataTypeOf :: SHA512t_224 -> DataType #

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

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

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

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

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

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

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

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

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

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

Show SHA512t_224 
HashAlgorithm SHA512t_224 
type HashInternalContextSize SHA512t_224 
type HashDigestSize SHA512t_224 
type HashBlockSize SHA512t_224 

class HashAlgorithm a where #

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.

Methods

hashBlockSize :: a -> Int #

Get the block size of a hash algorithm

hashDigestSize :: a -> Int #

Get the digest size of a hash algorithm

Instances

HashAlgorithm Whirlpool 
HashAlgorithm Tiger 
HashAlgorithm Skein512_512 
HashAlgorithm Skein512_384 
HashAlgorithm Skein512_256 
HashAlgorithm Skein512_224 
HashAlgorithm Skein256_256 
HashAlgorithm Skein256_224 
HashAlgorithm SHA512 
HashAlgorithm SHA384 
HashAlgorithm SHA3_512 
HashAlgorithm SHA3_384 
HashAlgorithm SHA3_256 
HashAlgorithm SHA3_224 
HashAlgorithm SHA256 
HashAlgorithm SHA224 
HashAlgorithm SHA1 
HashAlgorithm RIPEMD160 
HashAlgorithm MD5 
HashAlgorithm MD4 
HashAlgorithm MD2 
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 SHA512t_224 
HashAlgorithm SHA512t_256 
(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 () #

class ByteArrayAccess ba where #

Class to Access size properties and data of a ByteArray

Minimal complete definition

length, withByteArray

Methods

length :: ba -> Int #

Return the length in bytes of a bytearray

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

Allow to use using a pointer

copyByteArrayToPtr :: ba -> Ptr p -> IO () #

Copy the data of a bytearray to a ptr

Instances

ByteArrayAccess ByteString 

Methods

length :: ByteString -> Int #

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

copyByteArrayToPtr :: ByteString -> Ptr p -> IO () #

ByteArrayAccess String 

Methods

length :: String -> Int #

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

copyByteArrayToPtr :: String -> Ptr p -> IO () #

PrimType ty => ByteArrayAccess (UArray ty) 

Methods

length :: UArray ty -> Int #

withByteArray :: UArray ty -> (Ptr p -> IO a) -> IO a #

copyByteArrayToPtr :: UArray ty -> Ptr p -> IO () #

PrimType ty => ByteArrayAccess (Block ty) 

Methods

length :: Block ty -> Int #

withByteArray :: Block ty -> (Ptr p -> IO a) -> IO a #

copyByteArrayToPtr :: Block ty -> Ptr p -> IO () #

ByteArrayAccess (Context a) 

Methods

length :: Context a -> Int #

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

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

ByteArrayAccess (Digest a) 

Methods

length :: Digest a -> Int #

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

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