UNPKG

@waku/rln

Version:

RLN (Rate Limiting Nullifier) implementation for Waku

13 lines 611 B
import * as zerokitRLN from "@waku/zerokit-rln-wasm"; import { BytesUtils } from "./bytes.js"; export function poseidonHash(...input) { const inputLen = BytesUtils.writeUIntLE(new Uint8Array(8), input.length, 0, 8); const lenPrefixedData = BytesUtils.concatenate(inputLen, ...input); return zerokitRLN.poseidonHash(lenPrefixedData); } export function sha256(input) { const inputLen = BytesUtils.writeUIntLE(new Uint8Array(8), input.length, 0, 8); const lenPrefixedData = BytesUtils.concatenate(inputLen, input); return zerokitRLN.hash(lenPrefixedData); } //# sourceMappingURL=hash.js.map