0.1.4 • Published 4 years ago
blake3-native v0.1.4
blake3-native
Deprecated. Use the blake3
npm package.
Node.js bindings to the BLAKE3 hash function.
⚠️ This lib is a work-in-progress, check out the Issues page for things to be done. I'm a Rust newbie, so expect non-idiomatic code!
BLAKE3 is a cryptographic hash function that is:
- Much faster than MD5, SHA-1, SHA-2, SHA-3, and BLAKE2.
- Secure, unlike MD5 and SHA-1. And secure against length extension, unlike SHA-2.
- Highly parallelizable across any number of threads and SIMD lanes, because it's a Merkle tree on the inside.
- Capable of verified streaming and incremental updates, again because it's a Merkle tree.
- A PRF, MAC, KDF, and XOF, as well as a regular hash.
- One algorithm with no variants, which is fast on x86-64 and also on smaller architectures.
NOTE: BLAKE3 is not a password hashing algorithm, because it's designed to be fast, whereas password hashing should not be fast. If you hash passwords to store the hashes or if you derive keys from passwords, we recommend Argon2.
Installation
npm install blake3-native
Usage
hashing a single chunk of data
const blake3 = require('blake3-native')
const buf = str => Buffer.from(str, 'utf8')
console.log('at once:', blake3.hash(buf('some input!')))
// 948abea72a9c6bd221d734457c15def1be448efef2d48b91882e73cd9254f0bb
hashing chunks of data continuously
createHash
roughly follows the Node createHash
API.
const h = blake3.createHash()
h.update(buf('some '))
h.update(buf('input!'))
console.log('chunked:', h.digest())
// 948abea72a9c6bd221d734457c15def1be448efef2d48b91882e73cd9254f0bb
Contributing
If you have a question or need support using blake3-native
, please double-check your code and setup first. If you think you have found a bug or want to propose a feature, refer to the issues page.