UNPKG

@toruslabs/ffjavascript

Version:

Finite Field Library in Javascript

48 lines (47 loc) 2.98 kB
type ScalarInput = bigint | number | string; export declare function fromString(s: ScalarInput, radix?: number): bigint | undefined; export declare const e: typeof fromString; export declare function fromArray(a: number[], radix: number): bigint; export declare function bitLength(a: bigint): number; export declare function isNegative(a: ScalarInput): boolean; export declare function isZero(a: ScalarInput): boolean; export declare function shiftLeft(a: ScalarInput, n: ScalarInput): bigint; export declare function shiftRight(a: ScalarInput, n: ScalarInput): bigint; export declare const shl: typeof shiftLeft; export declare const shr: typeof shiftRight; export declare function isOdd(a: ScalarInput): boolean; export declare function naf(n: ScalarInput): number[]; export declare function bits(n: ScalarInput): number[]; export declare function toNumber(s: bigint): number; export declare function toArray(s: ScalarInput, radix: number): number[]; export declare function add(a: ScalarInput, b: ScalarInput): bigint; export declare function sub(a: ScalarInput, b: ScalarInput): bigint; export declare function neg(a: ScalarInput): bigint; export declare function mul(a: ScalarInput, b: ScalarInput): bigint; export declare function square(a: ScalarInput): bigint; export declare function pow(a: ScalarInput, b: ScalarInput): bigint; export declare function exp(a: ScalarInput, b: ScalarInput): bigint; export declare function abs(a: ScalarInput): bigint; export declare function div(a: ScalarInput, b: ScalarInput): bigint; export declare function mod(a: ScalarInput, b: ScalarInput): bigint; export declare function eq(a: ScalarInput, b: ScalarInput): boolean; export declare function neq(a: ScalarInput, b: ScalarInput): boolean; export declare function lt(a: ScalarInput, b: ScalarInput): boolean; export declare function gt(a: ScalarInput, b: ScalarInput): boolean; export declare function leq(a: ScalarInput, b: ScalarInput): boolean; export declare function geq(a: ScalarInput, b: ScalarInput): boolean; export declare function band(a: ScalarInput, b: ScalarInput): bigint; export declare function bor(a: ScalarInput, b: ScalarInput): bigint; export declare function bxor(a: ScalarInput, b: ScalarInput): bigint; export declare function land(a: ScalarInput, b: ScalarInput): bigint; export declare function lor(a: ScalarInput, b: ScalarInput): bigint; export declare function lnot(a: ScalarInput): boolean; export declare function toRprLE(buff: Uint8Array, o: number, e: bigint, n8: number): void; export declare function toRprBE(buff: Uint8Array, o: number, e: bigint, n8: number): void; export declare function fromRprLE(buff: Uint8Array, o?: number, n8?: number): bigint; export declare function fromRprBE(buff: Uint8Array, o?: number, n8?: number): bigint; export declare function toString(a: bigint, radix?: number): string; export declare function toLEBuff(a: bigint): Uint8Array; export declare const zero: bigint; export declare const one: bigint; export {};