merkle tree lib

This commit is contained in:
Alexey 2019-07-11 13:38:22 +03:00
parent c0e27ffafc
commit 65fd0202c5
4 changed files with 377 additions and 8 deletions

13
lib/MiMC.js Normal file
View file

@ -0,0 +1,13 @@
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;