cryptocoinjs / hdkey

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

chore: perf improvement #52

Closed kewde closed 1 year ago

kewde commented 1 year ago

This PR avoids calling publicKeyConvert because they are really slow using a pure BN.js implementation.

kewde commented 1 year ago

cc @RyanZim

RyanZim commented 1 year ago

I'm wondering if these assertions should be combined with the conditional here: https://github.com/cryptocoinjs/hdkey/blob/62c25cc655c9b554b3f9169d69809893408a877d/lib/hdkey.js#L49-L50

kewde commented 1 year ago

@RyanZim I was wondering the same, but I assume someone out there might be relying on the error messages, and changing the behavior might be considered a breaking change?

publicKeyConvert also verifies the public key internally, so we technically omit publicKeyVerify calls for uncompressed keys.

RyanZim commented 1 year ago

Ah, true; good point about the error messages.