Kangarootwelve
A fast tree-hashing XOF over 12-round Keccak, standardised in RFC 9861
About Kangarootwelve
Kangarootwelve is an extendable-output function (XOF). It takes the parameter custom. Its registry entry cites RFC 9861. It is also known as k12. NextSSL lists it in the standard tier and exposes it through the safe API.
Overview
KangarooTwelve (K12) is an extendable-output function from the Keccak team that uses a 12-round Keccak permutation and a tree mode for long inputs. It offers 128-bit security at several times the speed of SHAKE128.
K12 is built on TurboSHAKE128, which is SHAKE128 with the Keccak permutation reduced from 24 to 12 rounds. Inputs up to 8 KiB are hashed directly. Longer inputs are split into 8 KiB chunks; every chunk after the first is hashed independently into a 256-bit chaining value, and these values are appended to the first chunk and hashed in a final node. The chunks can be processed in parallel with SIMD or multiple cores.
K12 was introduced in 2016 and standardised, together with TurboSHAKE and the 256-bit-security KT256, in RFC 9861. It takes an optional customisation string. NextSSL includes KangarooTwelve (KT128). KT128 provides 128-bit security against all attacks, with output of any length. Its speed comes from both the reduced round count and the ability to process several chunks at once using vector instructions.
History
2016–2025KangarooTwelve published by the Keccak team
Specified in RFC 9861
Security notes
The 12-round Keccak permutation retains a large security margin: the best published attacks on Keccak reach about six rounds. No weaknesses specific to K12 are known.
Typical uses
Sizes
The registry declares no fixed sizes for this algorithm.
Parameters
| Name | Type | Range | Default | Required |
|---|---|---|---|---|
| custom | bytes | 0 – 65536 | — | no |
Parameters are passed as a string, for example nextssl_mac("hmac", "hash=sha512", …). Omitted parameters take their declared default.
Use it
from nextssl_demo import NextSSL
ns = NextSSL() # safe API: safe and standard tiers
out = ns.call("xof", "kangarootwelve", None, b"abc", 64)[0] # any length
nextssl_xof("kangarootwelve", NULL, data, 64, out);
use nextssl_core::Params;
use nextssl_registry::{self as reg, Policy};
let alg = reg::new_xof_in(reg::all(), Policy::Safe, "kangarootwelve", &Params::new())?;
let out = alg.squeeze(b"abc", 64)?;
Calls follow the NextSSL C ABI and its language bindings. Buffer sizes are validated against the sizes above.
More extendable-output functions
All 8Frequently asked questions
What is Kangarootwelve?
Kangarootwelve is a XOF in the KangarooTwelve family. KangarooTwelve (K12) is an extendable-output function from the Keccak team that uses a 12-round Keccak permutation and a tree mode for long inputs. It is also known as k12.
Who designed Kangarootwelve and when?
Kangarootwelve belongs to the KangarooTwelve family, first published in 2016 by Guido Bertoni, Joan Daemen, Michaël Peeters, Gilles Van Assche, Ronny Van Keer, Benoît Viguier. Its origin: RFC 9861.
Which standards define Kangarootwelve?
Kangarootwelve is referenced by RFC 9861.
Is Kangarootwelve safe to use?
Kangarootwelve is in the standard tier. Standardised and sound. Reachable from the safe API. It can be called from the safe API.
Related families
A Merkle-tree hash over BLAKE2s rounds, designed for parallel speed and unlimited output
SHA-3 and KeccakThe Keccak sponge, standardised by NIST in FIPS 202 as a structural alternative to SHA-2
BLAKE3A Merkle-tree hash over BLAKE2s rounds, designed for parallel speed and unlimited output
SHA-3 and KeccakThe Keccak sponge, standardised by NIST in FIPS 202 as a structural alternative to SHA-2
SHAKEThe extendable-output functions of FIPS 202, producing any length of output from Keccak
TurboSHAKESHAKE with the Keccak permutation reduced to 12 rounds, standardised in RFC 9861