## Keccak Algorithm Visualizer

### What is Keccak?

Keccak is a family of sponge functions designed by Guido Bertoni, Joan Daemen, Michaël Peeters, and Gilles Van Assche. In October 2012, Keccak won the NIST hash function competition, and is proposed as the SHA-3 standard. Keccak is based on a novel approach called sponge construction.

### Sponge Construction

Sponge construction is based on a wide random function or random permutation, and allows inputting ("absorbing" in sponge terminology) any amount of data, and outputting ( "squeezing") any amount of data. In the absorbing phase, message blocks are padded and XORed into the initial bits of the state, and then invertibly permuted. In the "squeeze" phase, output blocks are read from the same subset of the state, alternated with state transformations

### Keccak-f Permutations

The picture on the left shows the main state and parts of a state involved in Keccak.

This permutation defined for any power-of-two word size, w = 2ℓ bits

Main SHA-3 submission uses 64-bit words, where ℓ = 6.

Index arithmetic is performed modulo 5 for the first two dimensions and modulo w for the third.

**The one-dimensional parts are:**

- A row is a set of 5 bits with constant y and z coordinates.
- A column is a set of 5 bits with constant x and z coordinates.
- A lane is a set of w bits with constant x and y coordinates.

**The two-dimensional parts are:**

- A sheet is a set of 5w bits with constant x coordinate.
- A plane is a set of 5w bits with constant y coordinate.
- A slice is a set of 25 bits with constant z coordinate.

**The round function consists of 5 sub-functions: **

θ(Theta): iterates over each column of the state

ρ(Rho): iterates over each lane of the state

π(Pi): permutes positioning of lanes within state

χ(Chi): iterates over each row of state

ι(Iota): XORs a round constant with a modulus

Team Keccak, NIST Publication, SHA-3 Wikipedia, Bitcoin Wiki, SHIFT, NOT, AND, XOR, ROT/Circular Shift