UNPKG

micro-zk-proofs

Version:

Create & verify zero-knowledge SNARK proofs in parallel, using noble cryptography

23 lines 735 B
/** * MSM parallel worker, using micro-wrkr. * @module */ import { pippenger } from '@noble/curves/abstract/curve.js'; import {} from '@noble/curves/abstract/weierstrass.js'; import { bn254 } from '@noble/curves/bn254.js'; import { wrkr } from 'micro-wrkr'; function buildMSM(point) { return (list) => { if (!list.length) return point.ZERO; const points = list.map((i) => new point(i.point.X, i.point.Y, i.point.Z)); const scalars = list.map((i) => i.scalar); return pippenger(point, points, scalars); }; } const handlers = { bn254_msmG1: buildMSM(bn254.G1.Point), bn254_msmG2: buildMSM(bn254.G2.Point), }; wrkr.initWorker(handlers); //# sourceMappingURL=msm-worker.js.map