ddn.crypto.hash.blake

BLAKE2 and BLAKE3 Hash Implementations.

Types 5

BLAKE2b Core Implementation (Struct for low-level usage).

Fields
ulong[8] h
ulong[2] t
ulong[2] f
ubyte[128] buf
size_t buflen
size_t outlen
ulong[8] IV
ubyte[16][12] SIGMA
Methods
void init(size_t outlen, const(ubyte)[] key = null)
void update(const(ubyte)[] input)
void updateU32(uint val)
ubyte[] finish()
void incrementCounter(size_t inc)
void compress(bool last)
void G(ref ulong[16] v, int a, int b, int c, int d, ulong x, ulong y)
ulong rotr64(ulong x, int n)

BLAKE2b Digest Implementation (512-bit).

Fields
private Blake2bCore _core
private size_t _digestSize
Methods
Hash update(const(ubyte)[] input)
ubyte[] finish()
void reset()
size_t blockSize() @property const
size_t size() @property const
Constructors
this(size_t digestSize = 64)
Fields
uint[8] h
uint[2] t
uint[2] f
ubyte[64] buf
size_t buflen
size_t outlen
uint[8] IV
Methods
void init(size_t outlen, const(ubyte)[] key = null)
void update(const(ubyte)[] input)
ubyte[] finish()
void incrementCounter(size_t inc)
void compress(bool last)
void G(ref uint[16] v, int a, int b, int c, int d, uint x, uint y)
uint rotr32(uint x, int n)

BLAKE2s Digest Implementation (256-bit).

Fields
private Blake2sCore _core
private size_t _digestSize
Methods
Hash update(const(ubyte)[] input)
ubyte[] finish()
void reset()
size_t blockSize() @property const
size_t size() @property const
Constructors
this(size_t digestSize = 32)

BLAKE3 Implementation (32-bit words, 256-bit output default).

Uses the same compression function as BLAKE2s but with 7 rounds and fixed IV. Simplified for single-threaded reference (Chunk Loop).

Fields
private uint[8] IV
private int BLAKE3_ROUNDS
private ubyte[16][7] SIGMA
private uint[8][64] _stack
private ulong _stackLen
private ubyte[1024] _chunkBuf
private size_t _chunkBufLen
private ulong _chunkIndex
uint FLAG_CHUNK_START
uint FLAG_CHUNK_END
uint FLAG_PARENT
uint FLAG_ROOT
Methods
size_t blockSize() @property const
size_t size() @property const
private void addChunkCV(uint[8] newCV, ulong totalChunks)
void reset()
Hash update(const(ubyte)[] input)
private void processFullChunk()
ubyte[] finish()
private uint[8] compressParent(uint[8] left, uint[8] right, const(uint[8]) key, ulong counter, uint flags)
private uint[8] compressChunk(const(ubyte)[] chunk, ulong counter, uint flags)
private uint[16] compress(uint[8] h, ubyte[64] block, ulong counter, uint blockLen, uint flags)
Constructors