blake2b-wasm

WebJar for blake2b-wasm

Лицензия

Лицензия

MIT
Категории

Категории

ASM Библиотеки уровня приложения Bytecode Manipulation
Группа

Группа

org.webjars.npm
Идентификатор

Идентификатор

blake2b-wasm
Последняя версия

Последняя версия

1.1.7
Дата

Дата

Тип

Тип

jar
Описание

Описание

blake2b-wasm
WebJar for blake2b-wasm
Ссылка на сайт

Ссылка на сайт

http://webjars.org
Система контроля версий

Система контроля версий

https://github.com/mafintosh/blake2b-wasm

Скачать blake2b-wasm

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.webjars.npm/blake2b-wasm/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>blake2b-wasm</artifactId>
    <version>1.1.7</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/blake2b-wasm/
implementation 'org.webjars.npm:blake2b-wasm:1.1.7'
// https://jarcasting.com/artifacts/org.webjars.npm/blake2b-wasm/
implementation ("org.webjars.npm:blake2b-wasm:1.1.7")
'org.webjars.npm:blake2b-wasm:jar:1.1.7'
<dependency org="org.webjars.npm" name="blake2b-wasm" rev="1.1.7">
  <artifact name="blake2b-wasm" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='blake2b-wasm', version='1.1.7')
)
libraryDependencies += "org.webjars.npm" % "blake2b-wasm" % "1.1.7"
[org.webjars.npm/blake2b-wasm "1.1.7"]

Зависимости

compile (1)

Идентификатор библиотеки Тип Версия
org.webjars.npm : nanoassert jar [1.0.0,2)

Модули Проекта

Данный проект не имеет модулей.

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([digestLength], [key], [salt], [personal])

Create a new hash instance. digestLength defaults to 32.

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.

var promise = blake2b.ready([cb])

Wait for the WASM code to load. Returns the WebAssembly instance promise as well for convenience. You have to call this at least once before instantiating 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

wat2wasm blake2b.wat -o blake2b.wasm

To build the thin Javascript wrapper for the WASM module use wat2js:

# also available as `npm run compile`
wat2js blake2b.wat -o blake2b.js

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

License

MIT

Версии библиотеки

Версия
1.1.7