shake3
Nist fips pub 202: sha-3 standard: permutation-based hash and extendable-output functions
Usage
#include <sha3.h>
void
SHAKE128_Init(SHAKE128_CTX *ctx);
void
SHAKE128_Update(SHAKE128_CTX *ctx, const uint8_t *buf, size_t len);
void
SHAKE128_Final(uint8_t *output[], size_t outlen, SHAKE128_CTX *ctx);
void
SHAKE256_Init(SHAKE256_CTX *ctx);
void
SHAKE256_Update(SHAKE256_CTX *ctx, const uint8_t *buf, size_t len);
void
SHAKE256_Final(uint8_t *output[], size_t outlen, SHAKE256_CTX *ctx);
Library
library “libmd”
Overview
The SHAKE functions implement the extendable-output functions of the NIST SHA-3 standard, FIPS PUB 202. The SHAKE functions absorb an arbitrary-length message m and yield an arbitrary-length output SHAKE128(m) or SHAKE256(m), truncated to a specified number of octets.
Before using the SHAKE functions, applications should first call SHA3_Selftest(3) and confirm that it succeeded.
Only the SHAKE128 functions are specified in detail; the SHAKE256 functions are analogous.
The caller must allocate memory for a SHAKE128_CTX object to hold the state of a SHAKE128 computation over a message. SHAKE128_CTX objects may be copied or relocated in memory.
SHAKE128_Init(ctx)-
Initialize a SHAKE128 context. Must be done before any other operations on ctx.
SHAKE128_Update(ctx, data, len)-
Append len octets at data to the message.
SHAKE128_Final(output, outlen, ctx)-
Store at output the first outlen octets of the SHAKE128 output for the message obtained by concatenating all prior inputs to
SHAKE128_Update() on ctx.Subsequent use of ctx is not allowed, unless it is reinitialized with
SHAKE128_Init().