You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The master key fingerprint in BIP174 records are byte arrays of size 4, and in descriptors they are represented by 8 hex characters. These are the first four bytes of HASH160(pubkey).
bip32.go uses little-endian when parsing the master key fingerprint into an uint32. This confuses the user (me :-P), because one would expect Bip32Derivation.MasterKeyFingerprint to be represented as a [4]byte or at least a big-endian uint32.
I suggest using [4]byte instead, because the fingerprint is a sequence of four bytes.
If the current encoding must remain because of external dependencies, Bip32Derivation.MasterKeyFingerprint should at least be documented as being little-endian.
The text was updated successfully, but these errors were encountered:
I think the confusion comes from the concatenation of the master key fingerprint with uint32 little-endian integers, in BIP174. There is no mention of the byte-ordering of the parent key fingerprint in the BIP32 spec, so assuming little-endianness is not right.
On the contrary, there is an implementation of BIP32 in the codebase which uses big-endian when parsing the fingerprint into a uint32 integer.
It seems we should be able to come up with a failing test. I don't know if the [4]byte solution is better or the big-endian uint32 one; I suggest coming up with a PR and then discuss it during the review.
The master key fingerprint in BIP174 records are byte arrays of size 4, and in descriptors they are represented by 8 hex characters. These are the first four bytes of HASH160(pubkey).
bip32.go
uses little-endian when parsing the master key fingerprint into anuint32
. This confuses the user (me :-P), because one would expectBip32Derivation.MasterKeyFingerprint
to be represented as a[4]byte
or at least a big-endianuint32
.I suggest using
[4]byte
instead, because the fingerprint is a sequence of four bytes.If the current encoding must remain because of external dependencies,
Bip32Derivation.MasterKeyFingerprint
should at least be documented as being little-endian.The text was updated successfully, but these errors were encountered: