SHA3(3)
β¨ SHA3 β the girlies are hashing β¨
okay so bestie, welcome to SHA3(3) π this is the manual page for the SHA-3 crew, and it's giving NIST FIPS PUB 202: SHA-3 Standard: Permutation-Based Hash and Extendable-Output Functions. yes that's the whole official name, we don't abbreviate royalty π
π LIBRARY
Message Digest (MD4, MD5, etc.) Support Library β aka libmd, link it with -lmd π«Ά
πΈ SYNOPSIS
#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);
like look at that list. four flavours, all iconic, no notes π
π¦ DESCRIPTION
so the SHA3 functions implement the cryptographic hash functions of the NIST SHA-3 standard, FIPS PUB 202 β¨ what do they do tho? they compress an arbitrary-length message m into short fixed-length octet strings β SHA3-224(m), SHA3-256(m), etc. β and that output is called a cryptographic digest or hash. no cap, that's the whole vibe: you put in literally any amount of message, you get out a cute little fixed-size fingerprint π«Ά
β οΈ okay important bestie, listen: before using the SHA3 functions, applications should first call SHA3_Selftest(3) and confirm that it succeeded. do the vibe check first, fr fr π
ngl, only the SHA3_256 functions are specified in detail here β the SHA3_224, SHA3_384, and SHA3_512 functions are exactly analogous. same energy, different digest size, iykyk π
the caller has to allocate memory for a SHA3_256_CTX object to hold the state of a SHA3-256 hash computation over a message. and here's the fun part: SHA3_256_CTX objects are slightly over 200 bytes, and they may be copied or relocated in memory π like they're chill, they travel well, main character energy honestly.
SHA3_256_Init(ctx) : Initialize a SHA3-256 context. must be done before any other operations on ctx. no skipping, it's the first step, periodt π
SHA3_256_Update(ctx, data, len) : Append len octets at data to the message. feed it, feed it, feed it π
SHA3_256_Final(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.
π¨ and then: subsequent use of ctx is not allowed, unless it is reinitialized with SHA3_256_Init(). like it's done, it's retired, it said what it said. reinit or leave it alone bestie π
π SEE ALSO
go read those too, the lore is deep π§
β 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> β thank you king, we appreciate you π«Ά
okay and the cute sign-off: this page came from the Debian crew, dated October 14, 2015, and yeah it's SHA3(3) the whole way down π bye bestie, go hash something responsibly πΈ
π¦ where this page comes from
- alpine 3.24: libmd-doc 1.2.0-r0 Β· BSD-3-Clause AND BSD-2-Clause AND ISC AND Beerware AND Public Domain
- arch rolling: libmd 1.3.0-1 Β· BSD-3-Clause AND BSD-2-Clause AND ISC AND Beerware AND CC-PDM-1.0
- epel 10: libmd-devel 1.3.0-1.el10_3 Β· BSD-2-Clause AND BSD-3-Clause AND ISC AND Beerware AND LicenseRef-Fedora-Public-Domain
- epel 9: libmd-devel 1.3.0-1.el9 Β· BSD-2-Clause AND BSD-3-Clause AND ISC AND Beerware AND LicenseRef-Fedora-Public-Domain
- fedora 43: libmd-devel 1.2.0-1.fc43
- fedora 43: libmd-devel 1.2.0-1.fc43
- fedora 43: libmd-devel 1.3.0-1.fc43 Β· BSD-2-Clause AND BSD-3-Clause AND ISC AND Beerware AND LicenseRef-Fedora-Public-Domain
- fedora 43: libmd-devel 1.3.0-1.fc43 Β· BSD-2-Clause AND BSD-3-Clause AND ISC AND Beerware AND LicenseRef-Fedora-Public-Domain
- fedora 44: libmd-devel 1.3.0-1.fc44 Β· BSD-2-Clause AND BSD-3-Clause AND ISC AND Beerware AND LicenseRef-Fedora-Public-Domain
- fedora 44: libmd-devel 1.3.0-1.fc44 Β· BSD-2-Clause AND BSD-3-Clause AND ISC AND Beerware AND LicenseRef-Fedora-Public-Domain
- nixpkgs unstable: libmd 1.3.0
- ubuntu stonking: libmd-dev 1.2.0-2
- Copyright (c) 2015 Taylor R. Campbell
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms