UNPKG

@hugoalh/djb2a

Version:

A CLI and module to get the non-cryptographic hash of the data with algorithm DJB2a.

83 lines 2.5 kB
import "./_dnt.polyfills.js"; export type DJB2aAcceptDataType = string | BigUint64Array | Uint8Array | Uint16Array | Uint32Array; /** * Get the non-cryptographic hash of the data with algorithm DJB2a (32 bits). */ export declare class DJB2a { #private; get [Symbol.toStringTag](): string; /** * Initialize. * @param {DJB2aAcceptDataType} [data] Data. Can append later via the method {@linkcode DJB2a.update}. */ constructor(data?: DJB2aAcceptDataType); /** * Whether the instance is freezed. * @returns {boolean} */ get freezed(): boolean; /** * Freeze the instance to prevent any update. * @returns {this} */ freeze(): this; /** * Get the non-cryptographic hash of the data, in original format. * @returns {bigint} */ hash(): bigint; /** * Get the non-cryptographic hash of the data, in Base16. * @returns {string} */ hashBase16(): string; /** * Get the non-cryptographic hash of the data, in Base32Hex ({@link https://datatracker.ietf.org/doc/html/rfc4648#section-7 RFC 4648 §7}). * @returns {string} */ hashBase32Hex(): string; /** * Get the non-cryptographic hash of the data, in Base36. * @returns {string} */ hashBase36(): string; /** * Get the non-cryptographic hash of the data, in big integer. * @returns {bigint} */ hashBigInt(): bigint; /** * Get the non-cryptographic hash of the data, in big integer. * @returns {bigint} */ hashBigInteger: () => bigint; /** * Get the non-cryptographic hash of the data, in hex/hexadecimal without padding. * @returns {string} */ hashHex(): string; /** * Get the non-cryptographic hash of the data, in hex/hexadecimal with padding. * @returns {string} */ hashHexPadding(): string; /** * Get the non-cryptographic hash of the data, in number. * @returns {number} */ hashNumber(): number; /** * Append data. * @param {DJB2aAcceptDataType} data Data. * @returns {this} */ update(data: DJB2aAcceptDataType): this; /** * Initialize from the readable stream, asynchronously. * @param {ReadableStream<DJB2aAcceptDataType>} stream Readable stream. * @returns {Promise<DJB2a>} */ static fromStream(stream: ReadableStream<DJB2aAcceptDataType>): Promise<DJB2a>; } export default DJB2a; //# sourceMappingURL=mod.d.ts.map