MiMC.js 315 B

1234567891011121314
  1. const circomlib = require('circomlib')
  2. const mimcsponge = circomlib.mimcsponge
  3. const snarkjs = require('snarkjs')
  4. const bigInt = snarkjs.bigInt
  5. class MimcSpongeHasher {
  6. hash(level, left, right) {
  7. return mimcsponge.multiHash([bigInt(left), bigInt(right)]).toString()
  8. }
  9. }
  10. module.exports = MimcSpongeHasher