Sponge function

Illustration of the sponge construction
The sponge construction for hash functions. pi are blocks of the input string, zi are hashed output blocks.

In cryptography, a sponge function or sponge construction is a class of algorithms with finite internal state that take an input bit stream of any length and produce an output bit stream of any desired length. Sponge functions have both theoretical and practical uses. They can be used to model or implement most cryptographic primitives, including cryptographic hashes, message authentication codes, stream ciphers, block ciphers, pseudo-random number generators and authenticated encryption.[1]

Construction

A sponge function is built from three components:[2]

The state memory is divided into two sections: one of size r (the bitrate) and the other of size c (the capacity). These sections are denoted R and C respectively.

The padding function appends enough bits to the input string so that the length of the padded input is a whole multiple of the bitrate, r. The padded input can thus be broken into r-bit blocks.

Operation

The sponge function operates as follows:

The process is repeated until all the blocks of the padded input string are used up ("absorbed" in the sponge metaphor).

The sponge function output is now ready to be produced ("squeezed out") as follows:

The process is repeated until the desired number of output bits are produced. If the output length is not a multiple of r bits, it will be truncated.

Another metaphor describes the state memory as an "entropy pool", with input "poured into" the pool, and the transformation function referred to as "stirring the entropy pool".[3]

Note that input bits are never XORed into the C portion of the state memory, nor are any bits of C ever output directly. The extent to which C is altered by the input depends entirely on the transformation function f. In hash applications, resistance to collision or preimage attacks depends on C, and its size, the "capacity" c, is typically twice the desired resistance level.

Duplex construction

It is also possible to absorb and squeeze in an alternating fashion.[4] This operation is called the duplex construction or duplexing. It can be the basis of a single pass authenticated encryption system.

Overwrite mode

It is possible to omit the xor operations during absorption, while still maintaining the chosen security level.[4] In this mode, in the absorbing phase, the next block of the input overrides the R part of the state. This allows keeping a smaller state between the steps. Since the R part will be overwritten anyway, it can be discarded in advance, only the C part must be kept.

Applications

Sponge functions have both theoretical and practical uses. In theoretical cryptanalysis, a random sponge function is a sponge construction where f is a random permutation or transformation, as appropriate. Random sponge functions capture more of the practical limitations of cryptographic primitives than does the widely used random oracle model, in particular the finite internal state.[5]


The sponge construction can also be used to build practical cryptographic primitives. For example, the Keccak is a cryptographic sponge with a 1600-bit state. It has been selected by NIST as the winner in the SHA-3 competition. The strength of Keccak derives from the intricate, multi-round permutation f that its authors developed.[6] The RC4-redesign called Spritz (cipher) refers to the sponge-construct to define the algorithm.

For another example, a sponge function can be used to build authenticated encryption with associated data (AEAD).[3]

References

  1. The Keccak Team. "Duplexing The Sponge".
  2. Guido Bertoni, Joan Daemen, Michaël Peeters and Gilles Van Assche. "Sponge Functions". Ecrypt Hash Workshop 2007.
  3. 3.0 3.1 Rivest, Ron; Schuldt, Jacob (2014-10-27). "Spritz - a spongy RC4-like stream cipher and hash function". Retrieved 2014-12-29.
  4. 4.0 4.1 Guido Bertoni, Joan Daemen, Michaël Peeters and Gilles Van Assche. "Duplexing the sponge: single-pass authenticated encryption and other applications".
  5. Guido Bertoni, Joan Daemen, Michaël Peeters and Gilles Van Assche. "On the Indifferentiability of the Sponge Construction". EuroCrypt 2008.
  6. Boutin, Chad (2 October 2012). "NIST Selects Winner of Secure Hash Algorithm (SHA-3) Competition". NIST. Retrieved 4 October 2012.