liveBook · Manning

cSHAKE

As explained in Real-World Cryptography

cSHAKE is a customizable extendable output function in the SHA-3 family that accepts a function-name string and an optional customization string.

cSHAKE is a customizable extendable output function (XOF) in the SHA-3 family. Like SHAKE, it produces an output of any requested length; unlike SHAKE, it accepts a function-name string and an optional customization string. Different customization strings produce different deterministic outputs, enabling domain separation between cryptographic uses. section 2.5.3 section 2.7

Use cSHAKE when one underlying construction must behave like separate XOFs:

  • Choose a distinct customization string for each protocol role or use case. section 2.5.3
  • Request digest lengths suited to the application, including random-number or key-derivation outputs. section 2.5.3
  • Recognize KMAC as a wrapper that feeds encoded key, input, output length, function name, and optional customization into cSHAKE. section 3.5.2

Two customized outputs

For input "hello world" and a 256-bit output, customization "my_hash" produces 72444fde79690f0cac19e866d7e6505c, while "your_hash" produces 688a49e8c2a1e1ab4e78f887c1c73957. section 2.5.3

cSHAKE(input="hello world", output_length=256, custom_string="my_hash")
-> 72444fde79690f0cac19e866d7e6505c
cSHAKE(input="hello world", output_length=256, custom_string="your_hash")
-> 688a49e8c2a1e1ab4e78f887c1c73957

Compare cSHAKE calls directly and see how changing only the customization string changes the result. section 2.5.3

How Real-World Cryptography covers it

How deep it goes
Defines cSHAKE through its inputs and purpose, but stops short of implementation internals.
Examples
Demonstrates contrasting outputs for identical input and length under two customization strings, and describes KMAC's cSHAKE wrapper.
What it assumes
Builds from the ideas of SHA-3 and SHAKE, including hash outputs and arbitrary-length XOF results.
What you can do after
Apply cSHAKE with customization strings to separate protocol uses and request application-specific output lengths.
How it connects
Connects cSHAKE to SHAKE, SHA-3, XOFs, domain separation, and KMAC.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Real-World Cryptography. The section links point to the parts of the book it draws on.