cairo-vm-go icon indicating copy to clipboard operation
cairo-vm-go copied to clipboard

Poseidon Hash

Open rodrigo-pino opened this issue 1 year ago • 0 comments

One of the builtin required by the VM is the Poseidon Hash. It doesn't check when anything is written to it, and only triggers when inferring a value from it.

A Poseidon slot uses 6 cells. The first three are used as inputs (therefore the program should write to it before infering). The last three cells store the result of doing the Poseidon Permutation over the inputs.

The Bitwise and Pedersen Builtins are examples of how to implement the Poseidon Builtin. The general solution flow is:

  1. Read the input values, error accordingly
  2. Perform the Poseidon Hash
  3. Write the three output values

The difficult part of this is executing the math of the Poseidon Hash efficiently

rodrigo-pino avatar Nov 07 '23 14:11 rodrigo-pino