mirror of
https://github.com/tornadocash/tornado-nova
synced 2024-02-02 14:53:56 +01:00
18 lines
417 B
JavaScript
18 lines
417 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()
|
|
}
|
|
|
|
hashArray(items) {
|
|
return mimcsponge.multiHash(items.map(item => bigInt(item))).toString()
|
|
}
|
|
}
|
|
|
|
module.exports = MimcSpongeHasher
|