crypto: HMACSHA512 into crypto and add tests

This commit is contained in:
Daniel Cousens 2014-05-10 09:55:55 +10:00
parent f70ccc9215
commit 276a339d60
4 changed files with 42 additions and 17 deletions

View file

@ -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)
})
})
})
})