{"_id":"sync-multihash-sha2","name":"sync-multihash-sha2","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"sync-multihash-sha2","description":"Sync sha-256 & sha-512 multihash implementations","version":"1.0.0","keywords":["multiformats","multihash","sha256","sha512"],"prettier":{"trailingComma":"es5","tabWidth":2,"semi":false,"singleQuote":true},"repository":{"type":"git","url":"git+https://github.com/gozala/sync-multihash-sha2.git"},"homepage":"https://github.com/Gozala/sync-multihash-sha2","dependencies":{"@noble/hashes":"^1.3.1"},"devDependencies":{"@types/node":"20.3.1","multiformats":"^12.0.1","typescript":"^5.1.3","c8":"^7.13.0","entail":"^2.0.2","nyc":"^15.1.0","playwright-test":"git+https://github.com/Gozala/playwright-test.git#feat/any-runner"},"type":"module","main":"src/lib.js","module":"src/lib.js","types":"./dist/src/lib.d.ts","exports":{".":{"types":"./dist/src/lib.d.ts","import":"./src/lib.js","default":"./src/lib.js"},"./sha256":{"types":"./dist/src/sha256/web.d.ts","browser":"./src/sha256/web.js","node":"./src/sha256/node.js"},"./sha512":{"types":"./dist/src/sha512/web.d.ts","browser":"./src/sha512/web.js","node":"./src/sha512/node.js"}},"license":"(Apache-2.0 AND MIT)","scripts":{"build":"tsc --build","test:web":"playwright-test test --runner entail test/*.js --cov && nyc report","test:node":"c8 --check-coverage --branches 100 --functions 100 --lines 100 entail 'test/*.spec.js'","test":"c8 entail 'test/*.spec.js'","check":"tsc --build"},"bugs":{"url":"https://github.com/gozala/sync-multihash-sha2/issues"},"_id":"sync-multihash-sha2@1.0.0","_integrity":"sha512-A5gVpmtKF0ov+/XID0M0QRJqF2QxAsj3x/LlDC8yivzgoYCoWkV+XaZPfVu7Vj1T/hYzYS1tfjwboSbXjqocug==","_resolved":"/tmp/a5c21ba2900054eb74035981df9d55d8/sync-multihash-sha2-1.0.0.tgz","_from":"file:sync-multihash-sha2-1.0.0.tgz","_nodeVersion":"18.16.1","_npmVersion":"9.5.1","dist":{"integrity":"sha512-A5gVpmtKF0ov+/XID0M0QRJqF2QxAsj3x/LlDC8yivzgoYCoWkV+XaZPfVu7Vj1T/hYzYS1tfjwboSbXjqocug==","shasum":"b3004253cd0bde75ec303e4db1524d891fdbaac1","tarball":"https://registry.npmjs.org/sync-multihash-sha2/-/sync-multihash-sha2-1.0.0.tgz","fileCount":23,"unpackedSize":10245,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDIWLVp0i/AyBxTF0uk9tHxC4CJL7C3A6zAn0hAFvwk+QIhAJL66vAHKXLp2DJ1WthBkTdJ0CMghJGtgtNwdOuETz2S"}]},"_npmUser":{"name":"it-dag-house","email":"it+npm@dag.house"},"directories":{},"maintainers":[{"name":"it-dag-house","email":"it+npm@dag.house"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sync-multihash-sha2_1.0.0_1688607016952_0.23940972953064943"},"_hasShrinkwrap":false}},"time":{"created":"2023-07-06T01:30:16.848Z","1.0.0":"2023-07-06T01:30:17.119Z","modified":"2023-07-06T01:30:17.367Z"},"maintainers":[{"name":"it-dag-house","email":"it+npm@dag.house"}],"description":"Sync sha-256 & sha-512 multihash implementations","homepage":"https://github.com/Gozala/sync-multihash-sha2","keywords":["multiformats","multihash","sha256","sha512"],"repository":{"type":"git","url":"git+https://github.com/gozala/sync-multihash-sha2.git"},"bugs":{"url":"https://github.com/gozala/sync-multihash-sha2/issues"},"license":"(Apache-2.0 AND MIT)","readme":"# sync-multihash-sha2\n\nLibrary provides alternative implementation of sha256 and sha512 hashing algorithms for those rare cases where implementation provided by [multiformats] may be prohibitively slow.\n\n> ℹ️ 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.\n\n## Tradeoffs\n\ntl;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.\n\n### 💚 Faster & Sync\n\nLibrary 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.\n\n- It can can be used in synchronous code paths\n- It significantly faster in browsers\n\n### 💔 More dependencies\n\nSince this library does not leverage [web crypto APIs][`crypto.subtle.digest`] there is more code to be send over the wire. More dependencies also increase risk of supply chain attacks.\n\n### 💔 Less future proof\n\n[Web crypto APIs][`crypto.subtle.digest`] deliberately provide async APIs, which this library provides sync API. Furthermore, native implementation appears significantly slower, possibly because browsers rate-limit API calls.\n\nDifference in choices may prove problematic in longer.\n\n[multiformats]:https://github.com/multiformats/js-multiformats/\n[`SyncMultihashHasher`]:https://github.com/multiformats/js-multiformats/blob/4a36fb7ee49edb4300267b90301ef0e4300cbc46/src/hashes/interface.ts#L60-L72\n[`node:crypto`]:https://nodejs.org/api/crypto.html#class-hash\n[`@noble/hashes`]:https://www.npmjs.com/package/@noble/hashes\n[`crypto.subtle.digest`]:(https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/digest)\n","readmeFilename":"Readme.md"}