BIP32: Modified test vectors for hardened derivation with leading zeros #1030

pull silencer-Tsai wants to merge 1 commits into bitcoin:master from silencer-Tsai:test-vectors changing 1 files +16 −0
  1. silencer-Tsai commented at 9:10 AM on November 4, 2020: contributor

    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.

  2. schildbach commented at 9:34 AM on November 4, 2020: contributor

    I think old test vectors should not be deleted. They are needed as regression tests.

    FYI bitcoinj passes the new test vectors without changes.

  3. dgpv referenced this in commit def047e8f5 on Nov 4, 2020
  4. dgpv cross-referenced this on Nov 4, 2020 from issue Test vectors for BIP32 derivation with leading zeros (to sync with BIP) by dgpv
  5. BIP32: Added new test vectors for hardened derivation with leading zeros b0521f076c
  6. silencer-Tsai force-pushed on Nov 4, 2020
  7. silencer-Tsai commented at 10:04 AM on November 4, 2020: contributor

    @schildbach Agree. I have brought it back already.

  8. dgpv referenced this in commit 4084cc179a on Nov 4, 2020
  9. afk11 commented at 2:56 PM on November 4, 2020: contributor

    Thanks for sharing the test fixture!

  10. junderw commented at 4:28 PM on November 4, 2020: contributor

    So existing Test 3 is for testing if the initial seed -> master generation step works with a 0x00 leading private key part. Newly added Test 4 tests for the existing extended key -> child hardened key step for working with 0x00 leading private key part.

    This makes sense since most implementations perform the HMACs for seed -> master and node -> child in separate places in the code, so it makes sense to test both.

    LGTM

  11. dgpv referenced this in commit b41a484874 on Dec 4, 2020
  12. luke-jr requested review from sipa on Feb 3, 2021
  13. luke-jr assigned sipa on Feb 3, 2021
  14. luke-jr added the label Proposed BIP modification on Feb 3, 2021
  15. SomberNight referenced this in commit b856336f8c on Feb 18, 2021
  16. Giszmo commented at 12:41 AM on May 20, 2021: contributor

    What exactly is the hold-up here? LGTM!

  17. kristapsk cross-referenced this on May 25, 2021 from issue Additional BIP32 test vector for hardened derivation with leading zeros by kristapsk
  18. kristapsk referenced this in commit 64f3a88f6c on May 25, 2021
  19. kristapsk cross-referenced this on May 28, 2021 from issue test: Additional BIP32 test vector for hardened derivation with leading zeros by kristapsk
  20. sipa commented at 5:27 PM on May 28, 2021: member

    ACK, verified that it actually exercises derivation from a private key with leading 0 byte.

  21. murchandamus commented at 5:39 PM on May 28, 2021: none

    ACK b0521f076c0b40208e82208f5476c48071aab785

  22. MarcoFalke referenced this in commit 8c6df2b4ca on May 31, 2021
  23. MarcoFalke commented at 12:00 PM on May 31, 2021: member
  24. sidhujag referenced this in commit 63b003598e on Jun 1, 2021
  25. prusnak cross-referenced this on Jun 3, 2021 from issue Extra BIP32 test (new test vector #4) by optout21
  26. kristapsk approved
  27. kristapsk commented at 10:14 AM on June 7, 2021: none

    ACK b0521f076c0b40208e82208f5476c48071aab785

  28. t-bast referenced this in commit 6ec1fa889d on Jun 9, 2021
  29. t-bast cross-referenced this on Jun 9, 2021 from issue Add hardened derivation leading zeros test by t-bast
  30. t-bast referenced this in commit d9bee88f67 on Jun 9, 2021
  31. t-bast cross-referenced this on Jun 9, 2021 from issue Add hardened derivation leading zeros test by t-bast
  32. darosior referenced this in commit fb75b61200 on Jun 9, 2021
  33. MarcoFalke commented at 10:51 AM on June 11, 2021: member
  34. darosior commented at 10:53 AM on June 11, 2021: member
  35. kallewoof merged this on Jun 12, 2021
  36. kallewoof closed this on Jun 12, 2021

  37. t-bast referenced this in commit 2be760781b on Jun 14, 2021
  38. t-bast referenced this in commit 224fcee90b on Jun 14, 2021
  39. benthecarman cross-referenced this on Jun 22, 2021 from issue Add new BIP 32 leading zero test vectors by benthecarman
  40. ChristopherA cross-referenced this on Jun 25, 2021 from issue New test vectors for bip-32 by ChristopherA
  41. dgpv referenced this in commit 33ededbb8f on Jul 15, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bips. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-14 11:10 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me