
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
Why BLAKE2 for hashing? Because "BLAKE2 outperforms MD5, SHA-1, SHA-2, and SHA-3 on recent Intel CPUs" and has "no known security issues, whereas SHA-1, MD5, and SHA-512 are susceptible to length-extension". https://blake2.net/
node-blake2 provides a stream-compatible
blake2b, blake2bp, blake2s, and blake2sp Hash and KeyedHash for node 4+.
node-blake2 was tested to work on
On Windows, first install Python 2.7.13 so that node-gyp works.
In your project, run:
npm install blake2 --save
or install from the GitHub repo:
npm install ludios/node-blake2 --save
var blake2 = require('blake2');
var h = blake2.createHash('blake2b');
h.update(new Buffer("test"));
console.log(h.digest("hex"));
blake2.createHash works like node's
crypto.createHash.
var blake2 = require('blake2');
var h = blake2.createKeyedHash('blake2b', new Buffer('key - up to 64 bytes for blake2b, 32 for blake2s'));
h.update(new Buffer("test"));
console.log(h.digest("hex"));
blake2.createKeyedHash takes a key argument like
crypto.createHmac.
Although it is not an HMAC, a keyed hash serves the same purpose.
blake2.create{Hash,KeyedHash} support algorithms blake2b, blake2bp,
blake2s, and blake2sp..update on blake2.{Hash,KeyedHash} must be a Buffer.blake2.createKeyedHash(algo, key) must be a Buffer.crypto.Hash, .digest() can only be called once.This works exactly like it does with crypto.Hash. See b2sum.js.
BLAKE2 can generate digests between 1-64 bytes for BLAKE2b and 1-32 bytes for
BLAKE2s. Pass digestLength as an option to use a digest shorter than the
default (maximum length):
var blake2 = require('blake2');
var h = blake2.createHash('blake2b', {digestLength: 16});
h.update(new Buffer("test"));
h.digest(); // Returns a Buffer with 16 bytes
or with a key:
var blake2 = require('blake2');
var h = blake2.createKeyedHash('blake2b', new Buffer('my key'), {digestLength: 16});
h.update(new Buffer("test"));
h.digest(); // Returns a Buffer with 16 bytes
Note that BLAKE2 will generate completely different digests for shorter digest lengths; they are not simply a slice of the default digest.
You can call .copy() on a Hash or KeyedHash, which will return a new object with all of the internal BLAKE2 state copied from the source object.
var blake2 = require('blake2');
var h = blake2.createHash('blake2b');
h.update(new Buffer("test"));
// Call .copy() before .digest(), because .digest() finalizes internal state
var j = h.copy();
// h is unaffected by updates to j
j.update(new Buffer("more"));
console.log(h.digest());
console.log(j.digest());
FAQs
Computes blake2b N times, usefull for hash-based signatures.
We found that blake2_n demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.