Cshake256
Customisable SHAKE from SP 800-185, adding function-name and customisation strings
About Cshake256
Cshake256 is one of 2 cSHAKE variants in the NextSSL registry, an extendable-output function (XOF). It takes the parameter custom. Its registry entry cites NIST SP 800-185. NextSSL lists it in the standard tier and exposes it through the safe API.
Overview
cSHAKE is a customisable variant of SHAKE defined in NIST SP 800-185. It adds two inputs, a function name and a customisation string, so that different applications obtain independent functions from the same Keccak sponge.
cSHAKE encodes the function name N and customisation string S with length prefixes, pads them to a multiple of the sponge rate, and absorbs this block before the message, using a different domain-separation suffix from SHAKE. When both N and S are empty, cSHAKE is defined to be identical to SHAKE. NIST reserves function names for its own derived functions such as KMAC, TupleHash and ParallelHash.
NextSSL includes cSHAKE128 and cSHAKE256, providing 128-bit and 256-bit security levels. Applications should choose a unique customisation string, such as a protocol name and version, so that outputs used in different contexts cannot be confused or substituted for one another. The function name parameter is reserved for NIST-defined functions. Strings are public.
History
2016–2016Specified in NIST SP 800-185
Security notes
cSHAKE inherits Keccak's security with no known weaknesses. Customisation strings provide domain separation only; they are not secret and do not act as keys.
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", "cshake256", None, b"abc", 64)[0] # any length
nextssl_xof("cshake256", 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, "cshake256", &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.
Other cSHAKE variants
1Similar names
Looking for something else?More extendable-output functions
All 8Frequently asked questions
What is Cshake256?
Cshake256 is a XOF in the cSHAKE family. cSHAKE is a customisable variant of SHAKE defined in NIST SP 800-185.
Who designed Cshake256 and when?
Cshake256 belongs to the cSHAKE family, first published in 2016. Its origin: NIST SP 800-185.
Which standards define Cshake256?
Cshake256 is referenced by NIST SP 800-185. It is specified in a FIPS standard.
Is Cshake256 safe to use?
Cshake256 is in the standard tier. Standardised and sound. Reachable from the safe API. It can be called from the safe API.
What other cSHAKE variants are there?
NextSSL also registers cshake128 in the cSHAKE family.
Related families
An SP 800-185 hash that splits input into blocks so cSHAKE can process them in parallel
SHA-3 and KeccakThe Keccak sponge, standardised by NIST in FIPS 202 as a structural alternative to SHA-2
KMACNIST's Keccak-based MAC from SP 800-185, with optional arbitrary-length 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