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).
Takes binary input and returns it (multi) hash digest. Return value is
either promise of a digest or a digest. This way general use can await
while performance critical code may asses return value to decide whether
await is needed.
Sync variant of
MultihashHasher
that refines return type of thedigest
toMultihashDigest
. It is subtype ofMultihashHasher
so implementations of this interface can be passed anywhereMultihashHasher
is expected, allowing consumer to eitherawait
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).