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

# SHA3\_Selftest(3)

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

## NAME

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

## LIBRARY

library “libmd”

## SYNOPSIS

**#include \<sha3.h\>**

*int*\

**SHA3\_Selftest**(*void*);

## DESCRIPTION

The **SHA3\_Selftest** function automatically tests a number of SHA-3 computations on fixed inputs with with known outputs to make sure the [sha3(3)](/sha3/3.md) library is not catastrophically broken. Applications should call **SHA3\_Selftest**() and confirm that it succeeded before using the [sha3(3)](/sha3/3.md), or [shake(3)](/shake/3.md) functions.

**SHA3\_Selftest**() returns 0 if successful, or -1 if the self-test failed.

The **SHA3\_Selftest**() function costs a few hundred thousand cycles on most CPUs, since it involves a little over a hundred calls to the Keccak permutation, which usually take one or two thousand cycles each.

## SEE ALSO

[sha3(3)](/sha3/3.md), [shake(3)](/shake/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⟩
