Interface SyncMultihashHasher<Code>

Sync variant of MultihashHasher that refines return type of the digest to MultihashDigest. It is subtype of MultihashHasher so implementations of this interface can be passed anywhere MultihashHasher is expected, allowing consumer to either await or check the return type to decide whether to await or proceed with return value.

SyncMultihashHasher is useful in certain APIs where async hashing would be impractical e.g. implementation of Hash Array Mapped Trie (HAMT).

interface SyncMultihashHasher<Code> {
    code: Code;
    name: string;
    digest(input): MultihashDigest<Code>;
}

Type Parameters

  • Code extends number = number

Hierarchy (view full)

Properties

Methods

Properties

code: Code

Code of the multihash

name: string

Name of the multihash

Methods