Module blake2

This module implements BLAKE2 set of cryptographic hash functions designed by Jean-Philippe Aumasson, Luca Henzen, Willi Meier, Raphael C.W. Phan.

This module supports BLAKE2s-224/256 and BLAKE2b-384/512.

Tests for SHA3-225/256/384/512 made according to [https://github.com/BLAKE2/BLAKE2/tree/master/testvectors].

Types

Blake2Context = Blake2sContext | Blake2bContext
blake2_224 = Blake2sContext[224]
blake2_256 = Blake2sContext[256]
blake2_384 = Blake2bContext[384]
blake2_512 = Blake2bContext[512]
blake2 = blake2_224 | blake2_256 | blake2_384 | blake2_512

Procs

proc update(ctx: var Blake2Context; data: ptr byte; ulen: uint)
proc update[T: bchar](ctx: var Blake2Context; data: openArray[T]) {...}{.inline.}
proc finish(ctx: var Blake2sContext; data: ptr byte; ulen: uint): uint
"is greater or equals" operator. This is the same as y <= x.
proc finish(ctx: var Blake2bContext; data: ptr byte; ulen: uint): uint
"is greater or equals" operator. This is the same as y <= x.
proc finish(ctx: var Blake2sContext): MDigest[ctx.bits]
proc finish(ctx: var Blake2bContext): MDigest[ctx.bits]
proc finish[T: bchar](ctx: var Blake2Context; data: var openArray[T])
"is greater or equals" operator. This is the same as y <= x.
proc init(ctx: var Blake2Context; key: ptr byte = nil; keylen: uint = 0'u)
"is greater" operator. This is the same as y < x.
proc init[T: bchar](ctx: var Blake2Context; key: openArray[T]) {...}{.inline.}
proc clear(ctx: var Blake2Context) {...}{.inline.}

Templates

template BLGETU64(p, o): uint64
template BLGETU32(p, o): uint32
template sizeDigest(ctx: Blake2Context): uint
template sizeBlock(ctx: Blake2Context): uint
template sizeDigest(r: typedesc[blake2]): int
template sizeBlock(r: typedesc[blake2]): int