Closed GalaxySciTech closed 3 years ago
They are implemented in a separate mimc contract: https://github.com/iden3/circomlib/blob/master/src/mimcsponge_gencontract.js
What if I want to compile with solidity
In that case you have to write the code yourself. And it will likely be 10x more gas expensive.
I get the same problem, Why not publish the MiMCSponge
solidity source code?
Please ask original MiMCSponge devs to provide Solidity version
Because there is no solidity source code, and probably never will be, because it's inefficient
Here is solidity version: https://gist.github.com/poma/5adb51d49057d0a0edad2cbd12945ac4
it is quite inefficient, but how can you deploy your contracts?
Furthermore, Why not use the sha256
or keccak256
?
sha and keccak hashes are not snark friendly.
Solidity version from the gist will probably not even fit into max contract size and spends like 5x more gas. Circomlib version is written in EVM assembly and is small and fast.
https://github.com/tornadocash/tornado-core/blob/77af0c5bddfcf9d973efbc38278a249bb0173da3/contracts/MerkleTreeWithHistory.sol#L15