← Back to Bitcoin Improvement Proposals
BIPinformationalkey-management

BIP32: Modified test vectors for hardened derivation with leading zeros

As mentioned in https://github.com/bitpay/bitcore-lib/issues/47, https://github.com/iancoleman/bip39/issues/58 and https://github.com/btcsuite/btcutil/issues/172, the private key with leading zeros(i.e. less than 32 bytes) should be padded to 32 bytes when we derive a hardened child private key from a private key. Unfortunately, the original test vector 3 is not suitable for this case since both keys are 32 bytes. In the new test vectors, the key m/0<sub>H</sub> is 31 bytes. [btcsuite/btcutil

No reviews
silencer-Tsai·Updated Jun 12, 2021·0 reviews·0 attestations·View source
Collections:BIPs — Merged

Specification

As mentioned in https://github.com/bitpay/bitcore-lib/issues/47, https://github.com/iancoleman/bip39/issues/58 and https://github.com/btcsuite/btcutil/issues/172, the private key with leading zeros(i.e. less than 32 bytes) should be padded to 32 bytes when we derive a hardened child private key from a private key.

Unfortunately, the original test vector 3 is not suitable for this case since both keys are 32 bytes.

In the new test vectors, the key m/0<sub>H</sub> is 31 bytes.

btcsuite/btcutil just fix the bug. See https://github.com/btcsuite/btcutil/pull/182.

Discussion (0 threads)

Loading discussions...