asset-hash
Version:
Very fast asset hashing function for using e.g. during front-end deployments.
42 lines (41 loc) • 1.46 kB
TypeScript
import { DigestResult } from "./hash";
export declare function baseEncodeFactory(charset: string): {
decode: (str: string) => bigint;
encode: (number: bigint, maxLength?: number) => string;
};
export declare const baseEncoder: {
base26: {
decode: (str: string) => bigint;
encode: (number: bigint, maxLength?: number) => string;
};
base32: {
decode: (str: string) => bigint;
encode: (number: bigint, maxLength?: number) => string;
};
base36: {
decode: (str: string) => bigint;
encode: (number: bigint, maxLength?: number) => string;
};
base49: {
decode: (str: string) => bigint;
encode: (number: bigint, maxLength?: number) => string;
};
base52: {
decode: (str: string) => bigint;
encode: (number: bigint, maxLength?: number) => string;
};
base58: {
decode: (str: string) => bigint;
encode: (number: bigint, maxLength?: number) => string;
};
base62: {
decode: (str: string) => bigint;
encode: (number: bigint, maxLength?: number) => string;
};
};
export declare type SupportedEncoding = "base26" | "base32" | "base36" | "base49" | "base52" | "base58" | "base62" | "base64" | "hex" | "ascii";
export interface DigestOptions {
encoding?: SupportedEncoding;
maxLength?: number;
}
export declare function computeDigest(rawDigest: DigestResult, options?: DigestOptions): string;