SHAKE

Implementation of the SHAKE extendable output function (XOF). Standard: FIPS 202, SHA 3, Section 6.3

struct SHAKE (
uint bitsize
bool raw = false
) if (
bitsize == 128 ||
bitsize == 256
) {}

Members

Functions

nextBytes
void nextBytes(ubyte[] buf)
Undocumented in source. Be warned that the author may not have intended to support it.
put
void put(ubyte[] b)
Undocumented in source. Be warned that the author may not have intended to support it.
start
void start()
Undocumented in source. Be warned that the author may not have intended to support it.

Manifest constants

name
enum name;
Undocumented in source.

Examples

Test SHAKE128

import std.stdio;

SHAKE128 shake;
ubyte[32] buf;

shake.nextBytes(buf);

assert(buf == x"7f9c2ba4e88f827d616045507605853ed73b8093f6efbc88eb1a6eacfa66ef26", shake.name~" failed.");

shake.start();
shake.put(cast(const ubyte[]) "The quick brown fox jumps over the lazy dog");
shake.nextBytes(buf);
assert(buf == x"f4202e3c5852f9182a0430fd8144f0a74b95e7417ecae17db0f8cfeed0e3e66e", shake.name~" failed.");

Test SHAKE256

import std.stdio;

SHAKE256 shake;
ubyte[64] buf;

shake.nextBytes(buf);

assert(buf == x"46b9dd2b0ba88d13233b3feb743eeb243fcd52ea62b81b82b50c27646ed5762fd75dc4ddd8c0f200cb05019d67b592f6fc821c49479ab48640292eacb3b7c4be", shake.name~" failed.");

Meta