diff --git a/package.json b/package.json index 0acdbf2..6501a03 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,8 @@ "homepage": "https://github.com/cryptocoinjs/hdkey", "devDependencies": { "terst": "^0.1.0", - "mocha": "^1.19.0" + "mocha": "^1.19.0", + "bs58": "^1.0.0" }, "dependencies": { "sha512": "0.0.1" diff --git a/test/hdkey.test.js b/test/hdkey.test.js index c2f728b..8a0b159 100644 --- a/test/hdkey.test.js +++ b/test/hdkey.test.js @@ -1,10 +1,14 @@ +var crypto = require('crypto') +var bs58 = require('bs58') var HDKey = require('../') var fixtures = require('./fixtures') require('terst') function encode(buf) { - + var hash = crypto.createHash('sha256').update(buf).digest() + var chksum = crypto.createHash('sha256').update(hash).digest().slice(0,4) + return bs58.encode(Buffer.concat([buf, chksum])) } describe('hdkey', function() {