BLAKE3

BLAKE3 wrapper around BLAKE3 C API.

Members

Functions

finish
ubyte[32] finish()
Undocumented in source. Be warned that the author may not have intended to support it.
put
void put(const(ubyte)[] data)
Undocumented in source.
start
void start()
Undocumented in source.

Examples

verify digest of empty input

// output of b3sum on empty file:
static immutable ubyte[digestLength] expected = [
	0xaf, 0x13, 0x49, 0xb9, 0xf5, 0xf9, 0xa1, 0xa6,
    0xa0, 0x40, 0x4d, 0xea, 0x36, 0xdc, 0xc9, 0x49,
    0x9b, 0xcb, 0x25, 0xc9, 0xad, 0xc1, 0x12, 0xb7,
	0xcc, 0x9a, 0x93, 0xca, 0xe4, 0x1f, 0x32, 0x62,
];
BLAKE3 h;
h.start();
assert(h.finish == expected);

verify digest of non-empty input

const input = "Hello world!";
// output of b3sum on file containing `input`:
static immutable ubyte[digestLength] expected = [
    0x79, 0x3c, 0x10, 0xbc, 0x0b, 0x28, 0xc3, 0x78,
    0x33, 0x0d, 0x39, 0xed, 0xac, 0xe7, 0x26, 0x0a,
    0xf9, 0xda, 0x81, 0xd6, 0x03, 0xb8, 0xff, 0xed,
    0xe2, 0x70, 0x6a, 0x21, 0xed, 0xa8, 0x93, 0xf4
];
BLAKE3 h;
h.start();
h.put(cast(immutable(ubyte)[])input);
assert(h.finish == expected);

Meta