@hashbuf/types
v1.1.0
Published
Shared type definitions for hashbuf packages.
Downloads
8
Readme
@hashbuf/types
Shared type definitions for hashbuf packages.
Install
npm install @hashbuf/typesInterfaces
Hasher
A streaming hasher that accumulates data incrementally.
interface Hasher {
update(data: Uint8Array): this;
finalize(): Uint8Array;
reset(): this;
free(): void;
digest(): Uint8Array;
digest(encoding: 'hex'): string;
}HashAlgorithm
A hash algorithm providing both one-shot and streaming APIs.
interface HashAlgorithm {
readonly name: string;
readonly digestLength: number;
hash(data: Uint8Array): Uint8Array;
doubleHash(data: Uint8Array): Uint8Array;
createHasher(): Hasher;
stream(source: AsyncIterable<Uint8Array>): Promise<Uint8Array>;
}License
Apache-2.0
