6.7.4 • Published 5 years ago
simple-blake3 v6.7.4
BLAKE3 Cryptographic Hash Function
- 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.
Installation
~ npm i simple-blake3
Usage
With Key Protection
const blake3 = require('./index')
const toHash = 'Blake3 Please Hash Me'
const key = blake3.createKey()
//==> Secure Key Generated With NanoID
const hashed = blake3.hashKeyed(toHash, key)
//==> Create BLAKE3 Hash
console.log('Hashed: ', hashed)
const verified = blake3.verifyKeyed(toHash, hashed, key)
//==> Create New Hash And Match It
console.log('Verified: ', verified)
//⇒ True/False
Without Key
const blake3 = require('./index')
const toHash = 'Blake3 Please Hash Me'
const hashed = blake3.hash(toHash)
//==> Create BLAKE3 Hash
console.log('Hashed: ', hashed)
const verified = blake3.verify(toHash, hashed)
//==> Create New Hash And Match It
console.log('Verified: ', verified)
//⇒ True/False
Performance
BLAKE3 - 6866MiB/s
BLAKE2b - 1312MiB/s
SHA-1 - 1027MiB/s
BLAKE2s - 876MiB/s
MD5 - 740MiB/s
SHA-512 - 720MiB/s
SHA-256 - 484MiB/s
SHA3-256 - 394MiB/s