crypto: HMACSHA512 into crypto and add tests
This commit is contained in:
parent
f70ccc9215
commit
276a339d60
4 changed files with 42 additions and 17 deletions
test
|
@ -46,4 +46,18 @@ describe('Crypto', function() {
|
|||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('HMAC SHA512', function() {
|
||||
it('matches the test vector', function() {
|
||||
fixture.before.hex.forEach(function(hex, i) {
|
||||
var data = new Buffer(hex, 'hex')
|
||||
var secret = new Buffer(fixture.after.hmacsha512.secret)
|
||||
|
||||
var actual = crypto.HmacSHA512(data, secret)
|
||||
var expected = fixture.after.hmacsha512.hash[i]
|
||||
|
||||
assert.equal(actual.toString('hex'), expected)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue