@neabyte/quantum-zkp
Version:
Educational quantum-resistant zero-knowledge proof library for learning and prototyping
41 lines (40 loc) • 2.29 kB
TypeScript
import type { AlgorithmType } from '../types/index.js';
export declare class QuantumCrypto {
private static readonly VERSION;
static generateRandomBytes(length: number): Buffer;
static generateQuantumSafeChallenge(algorithm: AlgorithmType): Buffer;
static hash(data: Buffer | string, algorithm?: 'sha256' | 'sha384' | 'sha512'): Buffer;
static hmac(data: Buffer | string, key: Buffer | string, algorithm?: 'sha256' | 'sha384' | 'sha512'): Buffer;
static generateLargePrime(bits: number): bigint;
static generateRandomBigInt(min: bigint, max: bigint): bigint;
private static isStrongProbablePrime;
static millerRabinPrimalityTest(n: bigint, k?: number): boolean;
static isProbablePrime(n: bigint): boolean;
static modPow(base: bigint, exponent: bigint, modulus: bigint): bigint;
static createHashChain(seed: Buffer, length: number): Buffer[];
static combineHashes(hashes: Buffer[]): Buffer;
private static getChallengeLength;
static validateParameters(algorithm: AlgorithmType, parameters: Record<string, unknown>): boolean;
private static validateLatticeParameters;
private static validateHashParameters;
private static validateMultivariateParameters;
private static validateHybridParameters;
static bufferToBigInts(buffer: Buffer, count: number): bigint[];
static bigIntsToBuffer(ints: bigint[]): Buffer;
static generateLWESample(dimension: number, modulus: bigint, errorBound: bigint): {
a: bigint[];
b: bigint;
};
static generateDiscreteGaussianError(sigma: bigint): bigint;
static generateRLWEPolynomial(degree: number, modulus: bigint, errorBound: bigint): bigint[];
static polynomialMultiply(a: bigint[], b: bigint[], modulus: bigint): bigint[];
static generateMultivariateSystem(variables: number, equations: number, degree: number): bigint[][][];
static evaluateMultivariatePolynomial(polynomial: bigint[][], values: bigint[]): bigint;
static generateMerkleTree(leaves: Buffer[]): {
tree: Buffer[][];
root: Buffer;
};
static generateMerkleProof(tree: Buffer[][], leafIndex: number): Buffer[];
static verifyMerkleProof(leaf: Buffer, proof: Buffer[], root: Buffer, leafIndex: number): boolean;
static getVersion(): string;
}