tornado-core/lib/MiMC.js

13 lines
328 B
JavaScript
Raw Normal View History

2019-07-11 12:38:22 +02:00
const circomlib = require('circomlib');
const mimcsponge = circomlib.mimcsponge;
const snarkjs = require('snarkjs');
const bigInt = snarkjs.bigInt;
class MimcSpongeHasher {
hash(level, left, right) {
return mimcsponge.multiHash([bigInt(left), bigInt(right)]).toString();
}
}
module.exports = MimcSpongeHasher;