mirror of
https://github.com/tornadocash/tornado-core.git
synced 2025-05-06 00:05:06 -04:00
merkle tree lib
This commit is contained in:
parent
c0e27ffafc
commit
65fd0202c5
4 changed files with 377 additions and 8 deletions
13
lib/MiMC.js
Normal file
13
lib/MiMC.js
Normal 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;
|
Loading…
Add table
Add a link
Reference in a new issue