cryptol-3.0.0: Cryptol: The Language of Cryptography

Safe Haskell | Safe-Inferred
Language | Haskell2010

Cryptol.SHA

Contents

- Raw SHA block functions
- Internal routines included for testing

Description

Pure implementations of the SHA suite of hash functions. The implementation is basically an unoptimized translation of FIPS 180-2 into Haskell. If you're looking for performance, you probably won't find it here.

Synopsis

- data SHA256State = SHA256S !Word32 !Word32 !Word32 !Word32 !Word32 !Word32 !Word32 !Word32
- data SHA512State = SHA512S !Word64 !Word64 !Word64 !Word64 !Word64 !Word64 !Word64 !Word64
- data SHA256Block = SHA256Block !Word32 !Word32 !Word32 !Word32 !Word32 !Word32 !Word32 !Word32 !Word32 !Word32 !Word32 !Word32 !Word32 !Word32 !Word32 !Word32
- data SHA512Block = SHA512Block !Word64 !Word64 !Word64 !Word64 !Word64 !Word64 !Word64 !Word64 !Word64 !Word64 !Word64 !Word64 !Word64 !Word64 !Word64 !Word64
- processSHA512Block :: SHA512State -> SHA512Block -> SHA512State
- processSHA256Block :: SHA256State -> SHA256Block -> SHA256State
- initialSHA224State :: SHA256State
- initialSHA256State :: SHA256State
- initialSHA384State :: SHA512State
- initialSHA512State :: SHA512State
- toBigEndianSBS :: (Integral a, Bits a) => Int -> a -> ByteString
- fromBigEndianSBS :: (Integral a, Bits a) => ByteString -> a
- calc_k :: Word64 -> Word64 -> Word64 -> Word64
- padSHA1 :: ByteString -> ByteString
- padSHA512 :: ByteString -> ByteString
- padSHA1Chunks :: Int -> [ByteString]
- padSHA512Chunks :: Int -> [ByteString]

# Documentation

data SHA256State Source #

Constructors

SHA256S !Word32 !Word32 !Word32 !Word32 !Word32 !Word32 !Word32 !Word32 |

data SHA512State Source #

Constructors

SHA512S !Word64 !Word64 !Word64 !Word64 !Word64 !Word64 !Word64 !Word64 |

data SHA256Block Source #

Constructors

SHA256Block !Word32 !Word32 !Word32 !Word32 !Word32 !Word32 !Word32 !Word32 !Word32 !Word32 !Word32 !Word32 !Word32 !Word32 !Word32 !Word32 |

data SHA512Block Source #

Constructors

SHA512Block !Word64 !Word64 !Word64 !Word64 !Word64 !Word64 !Word64 !Word64 !Word64 !Word64 !Word64 !Word64 !Word64 !Word64 !Word64 !Word64 |

# Raw SHA block functions

processSHA512Block :: SHA512State -> SHA512Block -> SHA512State Source #

processSHA256Block :: SHA256State -> SHA256Block -> SHA256State Source #

initialSHA224State :: SHA256State Source #

initialSHA256State :: SHA256State Source #

initialSHA384State :: SHA512State Source #

initialSHA512State :: SHA512State Source #

# Internal routines included for testing

toBigEndianSBS :: (Integral a, Bits a) => Int -> a -> ByteString Source #

fromBigEndianSBS :: (Integral a, Bits a) => ByteString -> a Source #

calc_k :: Word64 -> Word64 -> Word64 -> Word64 Source #

padSHA1 :: ByteString -> ByteString Source #

padSHA512 :: ByteString -> ByteString Source #

padSHA1Chunks :: Int -> [ByteString] Source #

padSHA512Chunks :: Int -> [ByteString] Source #