classic-ui/services/mimc.js
FreezyEx b32527e057 Revert "minor fixes"
This reverts commit 7f8f7c2aa1.
2022-10-13 16:03:54 +02:00

19 lines
368 B
JavaScript

import { buildMimcSponge } from 'circomlibjs'
class Mimc {
constructor() {
this.sponge = null
this.hash = null
this.initMimc()
}
async initMimc() {
this.sponge = await buildMimcSponge()
this.hash = (left, right) => this.sponge.F.toString(this.sponge.multiHash([BigInt(left), BigInt(right)]))
}
}
const mimc = new Mimc()
export { mimc }