bigint-mod-arith/dist/index.d.ts

38 lines
1.4 KiB
TypeScript
Raw Normal View History

2023-04-13 16:31:30 +00:00
declare function abs(a: number | bigint): number | bigint;
declare function bitLength(a: number | bigint): number;
declare function crt(remainders: bigint[], modulos: bigint[], modulo?: bigint): bigint;
2023-04-13 16:31:30 +00:00
interface Egcd {
g: bigint;
x: bigint;
y: bigint;
}
declare function eGcd(a: number | bigint, b: number | bigint): Egcd;
declare function gcd(a: number | bigint, b: number | bigint): bigint;
declare function lcm(a: number | bigint, b: number | bigint): bigint;
declare function max(a: number | bigint, b: number | bigint): number | bigint;
declare function min(a: number | bigint, b: number | bigint): number | bigint;
declare function modAdd(addends: Array<number | bigint>, n: number | bigint): bigint;
2023-04-13 16:31:30 +00:00
declare function modInv(a: number | bigint, n: number | bigint): bigint;
declare function modMultiply(factors: Array<number | bigint>, n: number | bigint): bigint;
type PrimePower = [number | bigint, number | bigint];
type PrimeFactor = number | bigint | PrimePower;
declare function modPow(b: number | bigint, e: number | bigint, n: number | bigint, primeFactorization?: PrimeFactor[]): bigint;
type PrimeFactorization = Array<[bigint, bigint]>;
declare function phi(primeFactorization: PrimeFactorization): bigint;
2023-04-13 16:31:30 +00:00
declare function toZn(a: number | bigint, n: number | bigint): bigint;
export { Egcd, PrimeFactor, PrimeFactorization, PrimePower, abs, bitLength, crt, eGcd, gcd, lcm, max, min, modAdd, modInv, modMultiply, modPow, phi, toZn };