SHAKE(3)
π SHAKE(3) β like, the manual page for the SHAKE functions π
okay bestie, sit down, hydrate, and let me tell you about SHAKE β it's a real one from the Message Digest (MD4, MD5, etc.) Support Library (that's libmd, link it with -lmd) β¨
No cap, this is the page for the functions that do NIST FIPS PUB 202: SHA-3 Standard: Permutation-Based Hash and Extendable-Output Functions. Say that five times fast, I dare you π«Ά
π¦ LIBRARY π¦
Message Digest (MD4, MD5, etc.) Support Library β that's libmd, and you link it with -lmd. periodt π
β¨ 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 πΈ
So the SHAKE functions are the extendable-output functions from the NIST SHA-3 standard, FIPS PUB 202. The whole vibe is: you absorb an arbitrary-length message m, and you get back an arbitrary-length output β either SHAKE128(m) or SHAKE256(m) β truncated to a specified number of octets. Arbitrary in, arbitrary out, that's the whole point, iconic behavior fr fr π₯
Heads up bestie: before you touch the SHAKE functions, your app should first call SHA3_Selftest(3) and confirm that it succeeded. Do not skip this. It's giving "safety check before the main character moment" π
Only the SHAKE128 functions are specified in detail here β the SHAKE256 functions are analogous. (Same energy, different number, iykyk π)
The caller must allocate memory for a SHAKE128_CTX object to hold the state of a SHAKE128 computation over a message. And here's the cute part: SHAKE128_CTX objects may be copied or relocated in memory. Slay, they're portable like that π
π§ SHAKE128_Init(ctx)
Initialize a SHAKE128 context. This must be done before any other operations on ctx. Like, no exceptions, no shortcuts, do it first π
π§ SHAKE128_Update(ctx, data, len)
Append len octets at data to the message. Just keep feeding it, it's hungry, it can take as much as you've got π
π§ 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. This is the moment, the finale, the main character walk-off π
okay so listen: subsequent use ofctxis not allowed after this, unless it is reinitialized withSHAKE128_Init(). No zombie contexts, we don't do that here π
π SEE ALSO π
go read those too, bestie, it's a whole ecosystem π¦
β STANDARDS β
National Institute of Standards and Technology, SHA-3 Standard: Permutation-Based Hash and Extendable-Output Functions, August 2015, FIPS PUB 202. The receipt, the source, the whole lore πβ¨
π AUTHORS π
Taylor R Campbell <campbell+sha3@mumble.net> β thank you for your service, king π«Άπ
and that's the tea! this page came to you from Debian, dated October 14, 2015, and it lives at SHAKE(3) in the manual. mwah, go hash something cute π ππ
π¦ 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