开发者社区> 镜像站> NPM> double-hmac
double-hmac
Compare two Buffers using Double HMAC to protect against timing attacks
Last updated 4 years ago by emilbay .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install double-hmac 
SYNC missed versions from official npm registry.

double-hmac

Compare two Buffers using Double HMAC to protect against timing attacks

Install

npm install double-hmac

Usage

Note that this module only accepts Buffers.

const assert = require('assert')

const compare = require('double-hmac')

const a = Buffer.from('some string')
const b = Buffer.from('some other string')
const c = Buffer.from('some string')

compare(a, b, (err, equal) => {
  assert.ifError(err)
  assert.notOk(equal)
})

compare(a, c, (err, equal) => {
  assert.ifError(err)
  assert.notOk(equal)
})

API

doubleHmac(a, b, cb)

a

Type: Buffer

b

Type: Buffer

cb

Type: Function

Standard Node.js callback with arguments (err, equal), equal being Boolean

Security Notes

TODO

License

ISC

Current Tags

  • 1.0.0                                ...           latest (4 years ago)

1 Versions

  • 1.0.0                                ...           4 years ago
Maintainers (2)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dev Dependencies (1)
Dependents (0)
None