mirror of
https://github.com/tornadocash/tornado-core.git
synced 2025-03-03 04:09:25 -05:00
14 lines
314 B
JavaScript
14 lines
314 B
JavaScript
const poseidon = require('circomlib/src/poseidon')
|
|
const snarkjs = require('snarkjs')
|
|
|
|
const bigInt = snarkjs.bigInt
|
|
|
|
class PoseidonHasher {
|
|
hash(level, left, right) {
|
|
const hash = poseidon.createHash(3, 8, 57)
|
|
return hash([bigInt(left), bigInt(right)]).toString()
|
|
}
|
|
}
|
|
|
|
module.exports = PoseidonHasher
|