# How does the Keccak256 hash function work?

As the Ethereum platform relies on the Keccak256 hash algorithm, I'd like to get a better understanding of it.

My rough understanding is something like this:

a function accepting a finite set of bits into an giant imaginary rubik's cube which is then shunted about in a specific way. A subset of 256 bits are then returned. The function has the property that a change to a single input bit causes the output to change in an unpredictable way.

Is the above approximately true? You might see where I got the rubik's cube idea from if you look at Figure 1 here (I think this is the right spec).

There's also this, which I've read through, but it has not really soaked in.

How does the Keccak256 hash function work?

• This might be too broad. Found something that might help: slideshare.net/RajeevVerma14/keccakpptx (and it does have cube diagrams). – eth Jan 21 '17 at 22:45
• @eth thanks, shall I delete? – atomh33ls Jan 21 '17 at 22:46
• I think keep it and we can let the community vote and provide feedback (there might also be ways to edit it that might improve the question but I don't know enough so haven't upvoted), or someone might write a really good answer that you're looking for. – eth Jan 21 '17 at 22:49
• @eth I'll perhaps remove that last two questions... let's see – atomh33ls Jan 21 '17 at 22:54
• The sponge construction is the core. You divide the input into n blocks P0...Pn-1 (padding) and then starting with a block of zeros XOR the first formed block P0 and apply a permutation function f, the output of this function is passed to the next step that uses P1 and repeats until you have used all the blocks up to Pn-1. At this step, the data has been absorbed. You "squeeze" it by selecting a portion of the last state of the system and applying the function f to it until you obtain the desired number of bits in the output. This is very oversimplified but is the general idea. – Jaime Mar 29 '18 at 20:17