raaz-0.2.1: The raaz cryptographic library.

Safe Haskell | None
Language | Haskell2010

Raaz.Hash.Sha256

Contents

- The SHA256 cryptographic hash
- HMAC computation using SHA256

Description

This module exposes combinators to compute the SHA256 hash and the associated HMAC for some common types.

Synopsis

- data SHA256
- sha256 :: PureByteSource src => src -> SHA256
- sha256File :: FilePath -> IO SHA256
- sha256Source :: ByteSource src => src -> IO SHA256
- hmacSha256 :: PureByteSource src => Key (HMAC SHA256) -> src -> HMAC SHA256
- hmacSha256File :: Key (HMAC SHA256) -> FilePath -> IO (HMAC SHA256)
- hmacSha256Source :: ByteSource src => Key (HMAC SHA256) -> src -> IO (HMAC SHA256)

# The SHA256 cryptographic hash

data SHA256 Source #

The Sha256 hash value.

#### Instances

Instances details

Eq SHA256 Source # |
Instance details Defined in Raaz.Hash.Sha256.Internal Methods (==) :: SHA256 -> SHA256 -> Bool Source # (/=) :: SHA256 -> SHA256 -> Bool Source #
Show SHA256 Source # |
Instance details Defined in Raaz.Hash.Sha256.Internal Methods showsPrec :: Int -> SHA256 -> ShowS Source # show :: SHA256 -> String Source # showList :: [SHA256] -> ShowS Source #
IsString SHA256 Source # |
Instance details Defined in Raaz.Hash.Sha256.Internal Methods fromString :: String -> SHA256 Source #
Storable SHA256 Source # |

Instance details

Defined in Raaz.Hash.Sha256.Internal

Methods

sizeOf :: SHA256 -> Int Source #

alignment :: SHA256 -> Int Source #

peekElemOff :: Ptr SHA256 -> Int -> IO SHA256 Source #

pokeElemOff :: Ptr SHA256 -> Int -> SHA256 -> IO () Source #

peekByteOff :: Ptr b -> Int -> IO SHA256 Source #

pokeByteOff :: Ptr b -> Int -> SHA256 -> IO () Source #

peek :: Ptr SHA256 -> IO SHA256 Source #

poke :: Ptr SHA256 -> SHA256 -> IO () Source #

Equality SHA256 Source # |
Instance details Defined in Raaz.Hash.Sha256.Internal Methods eq :: SHA256 -> SHA256 -> Result Source #
EndianStore SHA256 Source # |
Instance details Defined in Raaz.Hash.Sha256.Internal Methods store :: Ptr SHA256 -> SHA256 -> IO () Source # load :: Ptr SHA256 -> IO SHA256 Source # adjustEndian :: Ptr SHA256 -> Int -> IO () Source #
Encodable SHA256 Source # |
Instance details Defined in Raaz.Hash.Sha256.Internal Methods toByteString :: SHA256 -> ByteString Source # fromByteString :: ByteString -> Maybe SHA256 Source # unsafeFromByteString :: ByteString -> SHA256 Source #
Recommendation SHA256 Source # | Recommended implementation for SHA256.
Instance details Defined in Raaz.Hash.Sha256.Recommendation Methods recommended :: SHA256 -> Implementation SHA256 Source #
Primitive SHA256 Source # |
Instance details Defined in Raaz.Hash.Sha256.Internal Associated Types type Implementation SHA256 Source # Methods blockSize :: SHA256 -> BYTES Int Source #
Hash SHA256 Source # |
Instance details Defined in Raaz.Hash.Sha256.Internal Methods additionalPadBlocks :: SHA256 -> BLOCKS SHA256 Source #
Initialisable (HashMemory SHA256) () Source # |
Instance details Defined in Raaz.Hash.Sha256.Internal Methods initialise :: () -> MT (HashMemory SHA256) () Source #
type Implementation SHA256 Source # |
Instance details Defined in Raaz.Hash.Sha256.Internal type Implementation SHA256 = SomeHashI SHA256

sha256 :: PureByteSource src => src -> SHA256 Source #

Compute the sha256 hash of an instance of `PureByteSource`. Use this for computing the sha256 hash of a strict or lazy byte string.

sha256File :: FilePath -> IO SHA256 Source #

Compute the sha256 hash of a file.

sha256Source :: ByteSource src => src -> IO SHA256 Source #

Compute the sha256 hash of a general byte source.

# HMAC computation using SHA256

hmacSha256 Source #

Arguments

:: PureByteSource src |
=> Key (HMAC SHA256) | Key to use
-> src | pure source whose hmac is to be computed
-> HMAC SHA256 |

Compute the message authentication code using hmac-sha256.

hmacSha256File Source #

Arguments

:: Key (HMAC SHA256) | Key to use
-> FilePath | File whose hmac is to be computed
-> IO (HMAC SHA256) |

Compute the message authentication code for a file.

hmacSha256Source :: ByteSource src => Key (HMAC SHA256) -> src -> IO (HMAC SHA256) Source #

Compute the message authetication code for a generic byte source.