Open AndriianChestnykh opened 2 years ago
It's depends on how large the MDS is. you can check out this linearhash (https://github.com/0xPolygonHermez/pil-stark/blob/main/circuits.gl/linearhash.circom) to support arbitrary size of inputs.
@eigmax, yes, it looks like the Poseidon itself depends on MDS constant values (so, the old contract generator couldn't even work properly with arbitrary input size, I guess). Thanks for pointing out the LinearHash function. It may be of help as a workaround.
Hi @eigmax. I have the same issue. I want to generate Ethereum Smart Contract that can support 16 inputs for Poseidon hash. Could I create a larger MDS that will support 16 inputs? I don't want to use any loops to manage 16 inputs (since loops are increasing gas consumption). For example, golang implementation of Poseidon hash supports 16 inputs from the box. https://github.com/iden3/go-iden3-crypto/blob/master/poseidon/poseidon_test.go#L14
@ilya-korotya sure, use Cauchy matrix mentioned in Poseidon's paper, and check out how neptune generates here: https://github.com/filecoin-project/neptune/blob/master/src/mds.rs#L21
@eigmax thanks a lot. It will be helpful.
Why there is no Poseidon contract generator for arbitrary number of has inputs? It can be only fixed and in 1..8 range.
As far as I remember, there some old contract generator version had this functionality. Although, the code was located in the iden3/circomlib repo at that time