You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

24 lines
655 B

/* global describe, it */
var assert = require('assert')
var bcrypto = require('../src/crypto')
var fixtures = require('./fixtures/crypto')
describe('crypto', function () {
['hash160', 'hash256', 'ripemd160', 'sha1', 'sha256'].forEach(function (algorithm) {
describe(algorithm, function () {
fixtures.forEach(function (f) {
var fn = bcrypto[algorithm]
var expected = f[algorithm]
it('returns ' + expected + ' for ' + f.hex, function () {
var data = new Buffer(f.hex, 'hex')
var actual = fn(data).toString('hex')
assert.strictEqual(actual, expected)
})
})
})
})
})