keccak-0.1.2: haskell keccak functions

Safe HaskellSafe
LanguageHaskell2010

Crypto.Hash.Keccak

Contents

Synopsis

Standard keccak hash functions

keccak224 :: ByteString -> ByteString Source #

Keccak (224 bits) cryptographic hash algorithm

keccak256 :: ByteString -> ByteString Source #

Keccak (256 bits) cryptographic hash algorithm

keccak384 :: ByteString -> ByteString Source #

Keccak (384 bits) cryptographic hash algorithm

keccak512 :: ByteString -> ByteString Source #

Keccak (512 bits) cryptographic hash algorithm

Standard SHA3 hash functions

sha3_512 :: ByteString -> ByteString Source #

SHA3 (512 bits) cryptographic hash algorithm

sha3_384 :: ByteString -> ByteString Source #

SHA3 (384 bits) cryptographic hash algorithm

sha3_256 :: ByteString -> ByteString Source #

SHA3 (256 bits) cryptographic hash algorithm

sha3_224 :: ByteString -> ByteString Source #

SHA3 (224 bits) cryptographic hash algorithm

Building blocks of a Keccak hash function

keccakHash :: Int -> ByteString -> ByteString Source #

Given a bitrate r, returns a standard Keccak hash with state width w = 1600 and capacity = 1600 - r

sha3Hash :: Int -> ByteString -> ByteString Source #

Given a bitrate r, returns a standard SHA3 hash with state width w = 1600 and capacity = 1600 - r

paddingKeccak :: Int -> ByteString -> [Word8] Source #

Appends a single bit 1 followed by the minimum number of bits 0 followed by a single bit 1 such that the length of the result is a multiple of the bitrate.

paddingSha3 :: Int -> ByteString -> [Word8] Source #

Appends to a message M padding of the form (M || 0x06 || 0x00... || 0x80) such that the length of the result is a multiple of the bitrate.

absorb :: Int -> [Word8] -> State Source #

Takes as input the bitrate rate and a string P with |P| a multiple of rate. Returns the value of the state obtained after absorbing P.

squeeze :: Int -> State -> ByteString Source #

Iteratively returns the outer part of the state as output blocks, interleaved with applications of the function keccakF. The number of iterations is determined by the requested number of bits l.