keccak-0.2.0: cryptographic functions based on the sponge construction

Safe HaskellNone
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

SHAKE extendable-output functions

shake128 :: Int -> ByteString -> ByteString Source #

SHAKE128 (128 bit security level) cryptographic extendable-output function

shake256 :: Int -> ByteString -> ByteString Source #

SHAKE256 (256 bit security level) cryptographic extendable-output function

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 -> Vector 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 -> Vector 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 -> Vector Word8 -> Vector Word64 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 -> Int -> Vector Word64 -> 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.