Socket
Socket
Sign inDemoInstall

blake2b-wasm

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

blake2b-wasm

Blake2b implemented in WASM


Version published
Weekly downloads
59K
increased by2.81%
Maintainers
1
Weekly downloads
 
Created
Source

blake2b-wasm

Blake2b implemented in WASM

npm install blake2b-wasm

Works in browsers that support WASM and Node.js 8+.

Usage

var blake2b = require('blake2b-wasm')

if (!blake2b.SUPPORTED) {
  console.log('WebAssembly not supported by your runtime')
}

blake2b.ready(function (err) {
  if (err) throw err

  var hash = blake2b()
    .update(Buffer.from('hello')) // pass in a buffer or uint8array
    .update(Buffer.from(' '))
    .update(Buffer.from('world'))
    .digest('hex')

  console.log('Blake2b hash of "hello world" is %s', hash)
})

API

var hash = blake2b()

Create a new hash instance

hash.update(data)

Update the hash with a new piece of data. data should be a buffer or uint8array.

var digest = hash.digest([enc])

Digest the hash.

Browser demo

There is a browser example included in example.html and example.js.

Contributing

The bulk of this module is implemented in WebAssembly in the blake2b.wat file. The format of this file is S-Expressions that can be compiled to their binary WASM representation by doing

# also available as `npm run compile`
wast2wasm blake2b.wat -o blake2b.wasm

If you do not have wast2wasm installed follow the instructions here, https://github.com/WebAssembly/wabt

License

MIT

FAQs

Package last updated on 08 Jun 2017

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc