mirror of
https://github.com/tornadocash/tornado-core.git
synced 2024-10-31 23:35:20 +01:00
13 lines
328 B
JavaScript
13 lines
328 B
JavaScript
|
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;
|