SHA3(3) Library Functions Manual SHA3(3)

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

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

#include <sha3.h>

void
SHA3_224_Init(SHA3_224_CTX *ctx);

void
SHA3_224_Update(SHA3_224_CTX *ctx, const uint8_t *buf, size_t len);

void
SHA3_224_Final(uint8_t digest[SHA3_224_DIGEST_LENGTH], SHA3_224_CTX *ctx);

void
SHA3_256_Init(SHA3_256_CTX *ctx);

void
SHA3_256_Update(SHA3_256_CTX *ctx, const uint8_t *buf, size_t len);

void
SHA3_256_Final(uint8_t digest[SHA3_256_DIGEST_LENGTH], SHA3_256_CTX *ctx);

void
SHA3_384_Init(SHA3_384_CTX *ctx);

void
SHA3_384_Update(SHA3_384_CTX *ctx, const uint8_t *buf, size_t len);

void
SHA3_384_Final(uint8_t digest[SHA3_384_DIGEST_LENGTH], SHA3_384_CTX *ctx);

void
SHA3_512_Init(SHA3_512_CTX *ctx);

void
SHA3_512_Update(SHA3_512_CTX *ctx, const uint8_t *buf, size_t len);

void
SHA3_512_Final(uint8_t digest[SHA3_512_DIGEST_LENGTH], SHA3_512_CTX *ctx);

The SHA3 functions implement the cryptographic hash functions of the NIST SHA-3 standard, FIPS PUB 202. The SHA3 functions compress an arbitrary-length message m into short fixed-length octet strings SHA3-224(m), SHA3-256(m), etc., called a cryptographic digest or hash.

Before using the SHA3 functions, applications should first call SHA3_Selftest(3) and confirm that it succeeded.

Only the SHA3_256 functions are specified in detail; the SHA3_224, SHA3_384, and SHA3_512 functions are exactly analogous.

The caller must allocate memory for a SHA3_256_CTX object to hold the state of a SHA3-256 hash computation over a message. SHA3_256_CTX objects are slightly over 200 bytes, and may be copied or relocated in memory.

(ctx)
Initialize a SHA3-256 context. Must be done before any other operations on ctx.
(ctx, data, len)
Append len octets at data to the message.
(digest, ctx)
Store at digest the 32-octet SHA3-256 hash of the message obtained by concatenating all prior inputs to SHA3_256_Update() on ctx.

Subsequent use of ctx is not allowed, unless it is reinitialized with ().

SHA3_Selftest(3), shake(3)

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

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

October 14, 2015 Linux 7.0.5-arch1-1