---
name: "shake"
section: "3"
platform: "linux"
package: "libmd"
version: "1.3.0-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/shake/3"
---

# shake(3)

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

## NAME

**SHAKE** – NIST FIPS PUB 202: SHA-3 Standard: Permutation-Based Hash and Extendable-Output Functions

## LIBRARY

library “libmd”

## 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)](/SHA3_Selftest/3.md) 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/3.md), [SHA3\_Selftest(3)](/SHA3_Selftest/3.md)

## 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⟩
