penumbra-zone / poseidon377

An instantiation of the Poseidon hash for use with decaf377
https://protocol.penumbra.zone/main/crypto/poseidon.html
Other
28 stars 10 forks source link

restore `poseidon-paramgen` #58

Open redshiftzero opened 5 months ago

redshiftzero commented 5 months ago

In #53, several crates in this workspace (poseidon-parameters, poseidon-permutation, poseidon377) were rewritten to use const generics such that they can be used on embedded platforms. During that work, poseidon-paramgen was removed as a build time dependency of poseidon377 in favor of hardcoding the existing parameter set in the params module. It would be nice to rewrite poseidon-paramgen such that we have a reproducible way of generating the parameters that are in use for Penumbra.

One challenge here is that now all matrices are of sizes fixed at compile time. This is fine for e.g. MDS matrices and submatrices, where the size of the matrices are determined by the state size of the hash function. However, the handling of the round constants will need to be reworked across all repositories in this workspace. This is because the size of the matrix of the round constants is (number_of_rounds, state_size) - but we don't know the number of rounds until we run the logic in the parameter generation code (i.e. at runtime, not at compile time).