BLAKE2b and BLAKE2s hash functions compiled to WebAssembly using Emscripten and optimized for small size
For pure JavaScript implementation that is not performance-critical you might want to consider blakejs instead.
npm install blake2.wasm
Node.js:
var blake2 = require('blake2.wasm')
blake2.ready(function () {
// Do stuff
});
Browser:
requirejs(['blake2.wasm'], function (blake2) {
blake2.ready(function () {
// Do stuff
});
})
callback
- Callback function that is called when WebAssembly is loaded and library is ready for use
Create Blake2b object that can later be updated with data
output_length
- Length of output hash in bytes, defaults to full 512-bit hash (64 bytes)key
- Secret key
Update instance with data
Get hash
Create Blake2s object that can later be updated with data
output_length
- Length of output hash in bytes, defaults to full 256-bit hash (32 bytes)key
- Secret key
Update instance with data
Get hash
Take a look at src/index.ls
for JsDoc sections with arguments and return types as well as methods description, look at tests/index.ls
for usage examples.
Feel free to create issues and send pull requests (for big changes create an issue first and link it from the PR), they are highly appreciated!
When reading LiveScript code make sure to configure 1 tab to be 4 spaces (GitHub uses 8 by default), otherwise code might be hard to read.
Free Public License 1.0.0 / Zero Clause BSD License