Compare two Buffers using Double HMAC to protect against timing attacks
npm install double-hmac
Note that this module only accepts Buffer
s.
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)
})
Type: Buffer
Type: Buffer
Type: Function
Standard Node.js callback with arguments (err, equal)
, equal
being Boolean
TODO