UNPKG

poseidon-h

Version:

Poseidon hash with alt_bn128 implementation in Typescript

18 lines 513 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.mix = exports.pow5 = void 0; const ff_1 = require("./ff"); const pow5 = (v) => { const o = v * v; return (v * o * o) % ff_1.P; }; exports.pow5 = pow5; const mix = (state, m) => { const mixed = [...Array(state.length)].map((_, j) => { const sum = state.reduce((a, b, i) => a + m[j][i] * b, 0n); return sum % ff_1.P; }); return mixed; }; exports.mix = mix; //# sourceMappingURL=operation.js.map