Skip to content

Commit

Permalink
Merge pull request #9 from braydonf/leading-zeros
Browse files Browse the repository at this point in the history
test: include derivation test when private key has leading zeros
  • Loading branch information
jprichardson authored Oct 20, 2016
2 parents b25cd0b + 5b788e9 commit 23713fe
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/hdkey.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,16 @@ describe('hdkey', function () {
})
})

describe('> when private key has leading zeros', function () {
it('will include leading zeros when hashing to derive child', function () {
var key = 'xprv9s21ZrQH143K3ckY9DgU79uMTJkQRLdbCCVDh81SnxTgPzLLGax6uHeBULTtaEtcAvKjXfT7ZWtHzKjTpujMkUd9dDb8msDeAfnJxrgAYhr'
var hdkey = HDKey.fromExtendedKey(key)
assert.equal(hdkey.privateKey.toString('hex'), '00000055378cf5fafb56c711c674143f9b0ee82ab0ba2924f19b64f5ae7cdbfd')
var derived = hdkey.derive("m/44'/0'/0'/0/0'")
assert.equal(derived.privateKey.toString('hex'), '3348069561d2a0fb925e74bf198762acc47dce7db27372257d2d959a9e6f8aeb')
})
})

describe('> when private key is null', function () {
it('privateExtendedKey should return null and not throw', function () {
var seed = '000102030405060708090a0b0c0d0e0f'
Expand Down

0 comments on commit 23713fe

Please sign in to comment.