---
title: "SHAKE128"
description: "The FIPS 202 sponge at 128-bit security. Squeezes 32 bytes unless you ask for another length"
canonical_url: "https://hashes.agntn.dev/algorithms/shake128"
---
# SHAKE128

> The FIPS 202 sponge at 128-bit security. Squeezes 32 bytes unless you ask for another length

<algorithm-facts name="shake128">



</algorithm-facts>

Need a digest with a length you choose? SHAKE128 keeps squeezing until you tell it to stop. ML-KEM and ML-DSA lean on it all day. It's a FIPS 202 extendable output function. It uses the same Keccak sponge as SHA-3, with different padding. [SHA3-256](https://hashes.agntn.dev/algorithms/sha3-256) is the same sponge with the length welded on.

`outputLength` sets the number of output bytes. It accepts any whole number from zero.

The default is 32 bytes. That's SHAKE128's full 128-bit security. Node's own default is 16, half of it, and OpenSSL 3 won't guess at all without `-xoflen`. Shorter output gives less collision resistance. At 16 bytes, it's 64 bits. Use the default unless you have a reason to shorten it.

```ts
create("shake128").hash("abc").digest;
// "5881092dd818bf5cf8a3ddb793fbcba74097d5c526a6d35f97b83351940f2cc8"
create("shake128").hash("abc", { outputLength: 16 }).digest;
// "5881092dd818bf5cf8a3ddb793fbcba7"
```

Those 16 bytes are the start of the longer output. Less output means less of the same stream, not another hash. So two lengths of one input aren't independent. Don't treat them as two keys.

The CLI flag is `--output-length`. Agent tools cap output at 1024 bytes per call. They also cap rounds times `outputLength` at 64 million bytes. Library callers can choose any length. Results report `outputLength` in their options only when you set it.

For bytes without the registry, import `shake128(bytes, length)` from `@agntn/hashes/keccak`. See [Hashing](https://hashes.agntn.dev/guide/hashing) and [SHAKE256](https://hashes.agntn.dev/algorithms/shake256).


## Sitemap

See the full [sitemap](https://hashes.agntn.dev/sitemap.md) for all pages.
