shake(3)

SHAKE(3) Library Functions Manual SHAKE(3)

NAME

SHAKENIST FIPS PUB 202: SHA-3 Standard: Permutation-Based Hash and Extendable-Output Functions

LIBRARY

Message Digest (MD4, MD5, etc.) Support Library (libmd, -lmd)

SYNOPSIS

#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);

DESCRIPTION

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().

SEE ALSO

sha3(3), SHA3_Selftest(3)

STANDARDS

National Institute of Standards and Technology, SHA-3 Standard: Permutation-Based Hash and Extendable-Output Functions, August 2015, FIPS PUB 202.

AUTHORS

Taylor R Campbell ⟨campbell+sha3@mumble.net⟩

October 14, 2015 Linux 6.12.85-6.12-alt1