You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This implementation is maintained, but will not receive new features. If you're looking for a full implementation of BLAKE2s, BLAKE2Xs and BLAKE2b, see my packages from StableLib: @stablelib/blake2s, @stablelib/blake2xs, and @stablelib/blake2b.
Installation
Via NPM:
$ npm install blake2s-js
or just download blake2s.min.js.
Usage
new BLAKE2s(digestLength, key)
new BLAKE2s(digestLength, config)
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.
.update(data[, offset, length])
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.
.digest()
Returns a Uint8Array with the digest of consumed data. Further updates will
throw error. Repeat calls of digest() will return the same digest.