blakesum-0.5: The BLAKE SHA-3 candidate hashes, in Haskell

Stabilityexperimental
MaintainerKevin Cantu <me@kevincantu.org>

Data.Digest.BLAKE

Contents

Description

BLAKE is one of the finalists in the NIST SHA-3 hash function competition to replace SHA-1 and SHA-2.

Synopsis

Digests

blake256Source

Arguments

:: ByteString

salt, 16 bytes

-> ByteString

message

-> ByteString

digest, 32 bytes

Compute a BLAKE-256 digest from a given salt and message

blake512Source

Arguments

:: ByteString

salt, 32 bytes

-> ByteString

message

-> ByteString

digest, 64 bytes

Compute a BLAKE-512 digest from a given salt and message

blake224Source

Arguments

:: ByteString

salt, 16 bytes

-> ByteString

message

-> ByteString

digest, 28 bytes

Compute a BLAKE-224 digest from a given salt and message (trucates output of a BLAKE-256)

blake384Source

Arguments

:: ByteString

salt, 32 bytes

-> ByteString

message

-> ByteString

digest, 48 bytes

Compute a BLAKE-384 digest from a given salt and message (trucates output of a BLAKE-512)

Text output

textDigest :: ByteString -> TextSource

Convert a digest (or other ByteString) to hexadecimal digits

For example, to compute a digest of a message, `0x00`, using BLAKE-512 (faster on 64 bit systems), with a salt of 0, and get the digits in hex:

 import Data.Digest.BLAKE
 import qualified Data.ByteString.Lazy as B

 textDigest $ blake512 (B.take 32 $ B.repeat 0) (B.singleton 0)