import type { MultihashDigest, MultihashHasher, SyncMultihashHasher, Phantom } from "multiformats"; /** * [Multicodec code] usually used to tag [multiformat]. * * [multiformat]:https://multiformats.io/ * [multicodec code]:https://github.com/multiformats/multicodec/blob/master/table.csv */ export type MulticodecCode = Code & Phantom; export interface Digest extends MultihashDigest { size: Size; } export interface Hasher extends MultihashHasher { size: Size; /** * Computes the digest of the given input and writes it into the given output * at the given offset. Unless `asMultihash` is `false` multihash is * written otherwise only the digest (without multihash prefix) is written. */ digestInto(input: Uint8Array, output: Uint8Array, offset?: number, asMultihash?: boolean): void | Promise; } export interface SyncHasher extends SyncMultihashHasher { size: Size; digest(input: Uint8Array): Digest; /** * Computes the digest of the given input and writes it into the given output * at the given offset. Unless `asMultihash` is `false` multihash is * written otherwise only the digest (without multihash prefix) is written. */ digestInto(input: Uint8Array, output: Uint8Array, offset?: number, asMultihash?: boolean): void; } export interface StreamingHasher { size: Size; code: Code; name: string; /** * Number of bytes currently consumed. */ count(): bigint; /** * Returns multihash digest of the bytes written so far. */ digest(): Digest; /** * Computes the digest of the given input and writes it into the given output * at the given offset. Unless `asMultihash` is `false` multihash is * written otherwise only the digest (without multihash prefix) is written. */ digestInto(output: Uint8Array, offset?: number, asMultihash?: boolean): this; /** * Writes bytes to be digested. */ write(bytes: Uint8Array): this; /** * Resets this hasher to its initial state. */ reset(): this; /** * Disposes this hasher and frees up any resources it may be holding on to. * After this is called this hasher should not be used. */ dispose(): void; } //# sourceMappingURL=type.d.ts.map