Keyboard shortcuts

Press ← or → to navigate between chapters

Press ? to show this help

Press Esc to hide this help

Compute digests with SHA-3 and generate variable-length output with SHAKE

A hash function computes a digest from an input of arbitrary length. If a publisher provides a signed digest, you can recompute the digest from your local copy to check that you received the same contents. To establish that the digest came from the publisher, verify the signature or obtain it through a trusted channel.

How it works · The SHA-3 sponge · How SHAKE produces more output

SHA-3 and SHAKE use the Keccak sponge construction. They absorb input into an internal state and read output from it. SHA3-256 and SHA3-512 produce 32 and 64 bytes, respectively. SHAKE128 and SHAKE256 are extendable-output functions (XOFs), so the caller chooses the output length independently of the numbers in the names.

from quantaegis import sha3_256, shake256

digest = sha3_256(b"release manifest")
assert len(digest) == 32
assert len(shake256(b"release manifest", 48)) == 48

The SDK also uses SHAKE256 to derive a key from the envelope’s shared secret. In Rust, you can process a long input in chunks with update. Envelope format · Rust API · FIPS 202