hmac-blake2b
HMAC backed by BLAKE2b
Last updated 5 months ago by emilbayes .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install hmac-blake2b 
SYNC missed versions from official npm registry.

hmac-blake2b

HMAC based on BLAKE2b

Even though BLAKE2b is designed to also work as a MAC, specifications like Noise call for a HMAC.

Usage

var sodium = require('sodium-universal')
var hmac = require('hmac-blake2b')

var mac = Buffer.alloc(hmac.BYTES)
var key = Buffer.alloc(hmac.KEYBYTES)
sodium.randombytes_buf(key)

var data = Buffer.from('some data')

hmac(mac, data, key)

API

hmac.BYTES

Size of the output MAC in bytes

hmac.KEYBYTES

RFC2104 recommended size of the key in bytes.

hmac(out, data, key)

Computes a HMAC from data with key and writes it into out.

  • out must be a Buffer or Uint8Array of length hmac.BYTES
  • data must be a Buffer, Uint8Array or Array of Buffers or Uint8Arrays.
  • key must be a Buffer or Uint8Array. Per the HMAC spec key can be as small as 1 byte, in which case it is right-padded with NUL bytes, or any size larger than hmac.KEYBYTES in which case it is hashed down to fit. The recommended size by the spec is hmac.KEYBYTES

Install

npm install hmac-blake2b

License

ISC

Current Tags

  • 2.0.0                                ...           latest (5 months ago)

5 Versions

  • 2.0.0                                ...           5 months ago
  • 1.0.0                                ...           7 months ago
  • 0.2.0                                ...           3 years ago
  • 0.1.1                                ...           3 years ago
  • 0.1.0                                ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 1
This Month 18
Last Day 0
Last Week 4
Last Month 29
Dependencies (3)
Dev Dependencies (1)
Dependents (1)

Copyright 2014 - 2016 © taobao.org |