UNPKG

micro-zk-proofs

Version:

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

63 lines 2.2 kB
/** * MiMC: Efficient Encryption and Cryptographic * Hashing with Minimal Multiplicative Complexity. * {@link https://eprint.iacr.org/2016/492.pdf} * {@link https://crypto.ethereum.org/bounties/mimc-hash-challenge} * @module */ /** * Derives the MiMC sponge IV from the seed. * @param seed - Seed string used for derivation. * @returns Field element used as the initial vector. * @example * Derive the default MiMC IV, or pass your own seed for compatibility tests. * ```ts * const iv = getIV('mimcsponge'); * ``` */ export declare function getIV(seed?: string): bigint; /** * Derives the MiMC round constants from the seed. * @param seed - Seed string used for derivation. * @param nRounds - Number of MiMC rounds to generate; must include the two zero endpoints. * @returns Round constant list. * @throws If `nRounds` is not an integer at least 2. {@link Error} * @example * Rebuild a short constant table for test vectors or compatibility checks. * ```ts * const constants = getConstants('mimcsponge', 4); * ``` */ export declare function getConstants(seed?: string, nRounds?: number): bigint[]; /** * Runs one MiMC sponge hash round sequence. * @param L - Left input lane. * @param R - Right input lane. * @param k - Key value. * @returns Updated left and right lanes. * @example * Run one MiMC round sequence on two field elements with an optional key. * ```ts * const round = hash(1n, 2n, 0n); * round.xL; * ``` */ export declare function hash(L: bigint, R: bigint, k: bigint): { xL: bigint; xR: bigint; }; /** * Hashes one or more field elements with the MiMC sponge. * @param lst - Input field elements. * @param key - Optional key value. * @param numOutputs - Number of outputs to squeeze; must be at least one. * @returns One field element or an array of field elements. * @throws If `numOutputs` is not an integer at least 1. {@link Error} * @example * Hash one or more field elements and optionally squeeze multiple outputs. * ```ts * const out = multiHash([1n, 2n], 0n, 2); * ``` */ export declare function multiHash(lst: bigint[], key?: bigint, numOutputs?: number): bigint | bigint[]; //# sourceMappingURL=mimcsponge.d.ts.map