Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
blake2s-js
Advanced tools
Pure JavaScript implementation of BLAKE2s cryptographic hash function.
BLAKE2 is a fast and secure cryptographic hash function.
This is a pure JavaScript public domain implementation of its BLAKE2s flavor (currently without tree mode support).
Looking for BLAKE2b implementation? Check out: https://github.com/dcposch/blakejs
Via NPM:
$ npm install blake2s-js
Via Bower:
$ bower install blake2s-js
or just download blake2s.min.js
.
Creates a new instance of BLAKE2s hash with the given length of digest (default
and maximum 32) and an optional secret key (a Uint8Array
or Array
of
bytes) or config object in the following format:
{
salt: // 8-byte Uint8Array or Array of bytes
personalization: // 8-byte Uint8Array or Array of bytes
key: // 0-32-byte Uint8Array or Array of bytes
}
All keys in config are optional.
Updates the hash with data (a Uint8Array
or Array
of bytes). starting at
the given offset
(optional, defaults to 0) and consuming the given length
(optional, defaults to the length of data
minus offset
).
Returns this instance to enable method chaining.
Returns a Uint8Array
with the digest of consumed data. Further updates will
throw error. Repeat calls of digest()
will return the same digest.
Like digest()
, but returns a hex-encoded string.
Maximum digest length.
Block size of the hash function.
Maximum key length.
Length of personalization parameter.
Length of salt parameter.
var h = new BLAKE2s(32);
h.update(new Uint8Array([1,2,3]));
h.hexDigest(); // returns string with hex digest
h.digest(); // returns Uint8Array
// Keyed:
var key = new Uint8Array(BLAKE2s.keyLength);
window.crypto.getRandomValues(key);
var h = new BLAKE2s(32, key);
...
// Keyed and salted:
var key = new Uint8Array(BLAKE2s.keyLength);
var salt = new Uint8Array(BLAKE2s.saltLength);
window.crypto.getRandomValues(key);
window.crypto.getRandomValues(salt);
var h = new BLAKE2s(32, { key: key, salt: salt });
...
// Personalized:
var data = new Uint8Array([1, 2, 3]);
var pers1 = new Uint8Array([1, 0, 0, 0, 0, 0, 0, 0]);
var h1 = new BLAKE2s(32, { personalization: pers1 });
h1.update(data);
var pers2 = new Uint8Array([2, 0, 0, 0, 0, 0, 0, 0]);
var h2 = new BLAKE2s(32, { personalization: pers2 });
h2.update(data);
h1.hexDigest() !== h2.hexDigest() // true
FAQs
Pure JavaScript implementation of BLAKE2s cryptographic hash function.
The npm package blake2s-js receives a total of 43 weekly downloads. As such, blake2s-js popularity was classified as not popular.
We found that blake2s-js 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.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.