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. BIP32: Added new test vectors for hardened derivation with leading zeros b0521f076c
  5. silencer-Tsai force-pushed on Nov 4, 2020
  6. silencer-Tsai commented at 10:04 AM on November 4, 2020: contributor

    @schildbach Agree. I have brought it back already.

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

    Thanks for sharing the test fixture!

  9. 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

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

    What exactly is the hold-up here? LGTM!

  16. kristapsk referenced this in commit 64f3a88f6c on May 25, 2021
  17. 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.

  18. murchandamus commented at 5:39 PM on May 28, 2021: member

    ACK b0521f076c0b40208e82208f5476c48071aab785

  19. maflcko referenced this in commit 8c6df2b4ca on May 31, 2021
  20. maflcko commented at 12:00 PM on May 31, 2021: member
  21. sidhujag referenced this in commit 63b003598e on Jun 1, 2021
  22. kristapsk approved
  23. kristapsk commented at 10:14 AM on June 7, 2021: none

    ACK b0521f076c0b40208e82208f5476c48071aab785

  24. t-bast referenced this in commit 6ec1fa889d on Jun 9, 2021
  25. t-bast referenced this in commit d9bee88f67 on Jun 9, 2021
  26. darosior referenced this in commit fb75b61200 on Jun 9, 2021
  27. maflcko commented at 10:51 AM on June 11, 2021: member
  28. darosior commented at 10:53 AM on June 11, 2021: member
  29. kallewoof merged this on Jun 12, 2021
  30. kallewoof closed this on Jun 12, 2021

  31. t-bast referenced this in commit 2be760781b on Jun 14, 2021
  32. t-bast referenced this in commit 224fcee90b on Jun 14, 2021
  33. dgpv referenced this in commit 33ededbb8f on Jul 15, 2021
  34. knst referenced this in commit c213b5fe5c on Nov 28, 2023
  35. knst referenced this in commit 3dcaba4e46 on Nov 30, 2023
  36. UdjinM6 referenced this in commit d8ea1bb035 on Nov 30, 2023
  37. PastaPastaPasta referenced this in commit f9c8136f80 on Dec 4, 2023
  38. refactor-forge70 referenced this in commit ab4fac60f5 on Sep 28, 2025
  39. tx-ravenxbsw3 referenced this in commit 79fd4f0cab on Sep 29, 2025
  40. rawBit-io referenced this in commit a25ac701a3 on Nov 6, 2025

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-05-19 06:50 UTC