cryptocoinjs / hdkey

JavaScript component for Bitcoin hierarchical deterministic keys (BIP32)
MIT License
201 stars 74 forks source link

Bug: Derive only takes string while deriveChild takes index #33

Closed junderw closed 4 years ago

junderw commented 4 years ago

I doubt anyone has ever hit this bug, but it's still a bug.

No clue how we could test for it though...

jprichardson commented 4 years ago

Yikes. utACK.

danfinlay commented 4 years ago

Can someone give me a guess of how rare this bug would have been, and what kinds of conditions would have triggered it? I'm investigating possible causes of another issue, and I'd like to rule this out if possible.

junderw commented 4 years ago

The chance of hitting this bug is 0.000000000000000000000000000000000000373 % per every derivation level.

>>> ((2**256-1) - 0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141)/(2**256-1)
3.734455345040134e-39

tbh by the time anyone hits this bug the heat death of the universe will be upon us.