UNPKG

@hugoalh/sdbm

Version:

A module to get the non-cryptographic hash of the data with algorithm SDBM.

47 lines 1.46 kB
export type SDBMAcceptDataType = string | BigUint64Array | Uint8Array | Uint16Array | Uint32Array; /** * Get the non-cryptographic hash of the data with algorithm SDBM (32 bits). */ export declare class SDBM { #private; get [Symbol.toStringTag](): string; /** * Initialize. * @param {SDBMAcceptDataType} [data] Data. Can append later via the method {@linkcode SDBM.update} and {@linkcode SDBM.updateFromStream}. */ constructor(data?: SDBMAcceptDataType); /** * Whether the instance is freezed. * @returns {boolean} */ get freezed(): boolean; /** * Freeze the instance to prevent any further update. * @returns {this} */ freeze(): this; /** * Get the non-cryptographic hash of the data, in Uint8Array. * @returns {Uint8Array} */ hash(): Uint8Array; /** * Get the non-cryptographic hash of the data, in hexadecimal with padding. * @returns {string} */ hashHex(): string; /** * Append data. * @param {SDBMAcceptDataType} data Data. * @returns {this} */ update(data: SDBMAcceptDataType): this; /** * Append data from the readable stream. * @param {ReadableStream<SDBMAcceptDataType>} stream Data from the readable stream. * @returns {Promise<this>} */ updateFromStream(stream: ReadableStream<SDBMAcceptDataType>): Promise<this>; } export default SDBM; //# sourceMappingURL=mod.d.ts.map