Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@bitgo-beta/blake2b
Advanced tools
@bitgo/blake2b
Blake2b (64-bit version) in pure JavaScript
This module is based on @dcposch implementation of BLAKE2b, with some changes:
out
buffer, saving an allocationsalt
and personal
parametersAll credit goes to @dcposch for doing the hard work of porting the implementation from C to JavaScript.
var blake2b = require('@bitgo/blake2b');
var output = new Uint8Array(64);
var input = Buffer.from('hello world');
console.log('hash:', blake2b(output.length).update(input).digest('hex'));
var hash = blake2b(outLength, [key], [salt], [personal], [noAssert = false])
Create a new hash instance, optionally with key
, salt
and
personal
. Bypass input assertions by setting noAssert
to true
.
All parameters must be Uint8Array
, Buffer
or another object with a compatible
API. All parameters must also fulfill the following constraints, or an
AssertionError
will be thrown (unless noAssert = true
):
outLength
must within the byte ranges defined by the constants below.key
is optional, but must within the byte ranges defined by the constants
below, if given. This value must be kept secret, and can be used to create
prefix-MACs.salt
is optional, but must be exactly SALTBYTES
, if given. You can use
this parameter as a kind of per user id, or local versioning scheme. This
value is not required to be secret.personal
is optional, but must be exactly PERSONALBYTES
, if given. You can
use this parameter as a kind of app id, or global versioning scheme. This
value is not required to be secret.var hash = hash.update(input)
Update the hash with new input
. Calling this method after .digest
will throw
an error.
var out = hash.digest(out)
Finalise the the hash and write the digest to out
. out
must be exactly equal
to outLength
given in the blake2b
method.
Optionally you can pass hex
to get the hash as a hex string or no arguments
to have the hash return a new Uint8Array with the hash.
blake2b.BYTES_MIN
Minimum length of out
blake2b.BYTES_MAX
Maximum length of out
blake2b.BYTES
Recommended default length of out
blake2b.KEYBYTES_MIN
Minimum length of key
blake2b.KEYBYTES_MAX
Maximum length of key
blake2b.KEYBYTES
Recommended default length of key
blake2b.SALTBYTES
Required length of salt
blake2b.PERSONALBYTES
Required length of personal
npm install @bitgo/blake2b
This repository includes test vectors with
{outlen, out, input, key, salt, personal}
objects for testing conformance
against the spec and other implementations:
FAQs
Blake2b (64-bit version) in pure JavaScript
The npm package @bitgo-beta/blake2b receives a total of 31,403 weekly downloads. As such, @bitgo-beta/blake2b popularity was classified as popular.
We found that @bitgo-beta/blake2b 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
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.