sync-multihash-sha2
v1.0.0
Published
Sync sha-256 & sha-512 multihash implementations
Downloads
15,754
Maintainers
Readme
sync-multihash-sha2
Library provides alternative implementation of sha256 and sha512 hashing algorithms for those rare cases where implementation provided by multiformats may be prohibitively slow.
ℹ️ In vast majority of use cases multiformats is better choice. In rare instances where multiformats does not meet your requirements you could use this library, but please make sure to consider the offered tradeoffs.
Tradeoffs
tl;dr: This implementation has sync API and is faster in browsers, but more dependencies implies more bytes over the wire and greater risk of supply chain attacks.
💚 Faster & Sync
Library provides SyncMultihashHasher
implementation which provides sync API in browser and node environments. This is accomplished by leveraging node:crypto
in node and in @noble/hashes
in browsers.
- It can can be used in synchronous code paths
- It significantly faster in browsers
💔 More dependencies
Since this library does not leverage web crypto APIs there is more code to be send over the wire. More dependencies also increase risk of supply chain attacks.
💔 Less future proof
Web crypto APIs deliberately provide async APIs, which this library provides sync API. Furthermore, native implementation appears significantly slower, possibly because browsers rate-limit API calls.
Difference in choices may prove problematic in longer.