pseudo-crypto
Version:
Hash numeric identifiers.
47 lines (44 loc) • 1.15 kB
TypeScript
type CharacterSetType = '09' | 'numeric' | '._' | 'inline' | '.-' | 'wide' | '-|' | 'thin' | 'az' | 'lowercase' | 'AZ' | 'uppercase' | 'Az' | 'alphabetic' | 'A9' | 'alphanumeric';
declare class PseudoCrypto {
/**
* @type {boolean}
* Should always unhash to BigInt?
*/
onlyBigInt: boolean;
/**
* @type {string}
* Fill string.
*/
private fillString;
/**
* @type {bigint}
* Character count.
*/
private characterCount;
/**
* @type {array}
* Character codes.
*/
private characterCodes;
/**
* @type {array}
* Next primes greater than
* character_count ^ i /
* 1.618033988749894.
*/
private goldenPrimes;
/**
* @type {array}
* Modular multiplicative
* inverses of the primes
* (mod character_count ^ i).
*/
private goldenInverses;
constructor(type?: CharacterSetType, onlyBigInt?: boolean);
private adjustType;
private base;
hash(number: number | bigint, length?: number): string;
private unbase;
unhash(string: string): number | bigint;
}
export { PseudoCrypto as default };