Bitcoin Forum
May 01, 2024, 11:57:10 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: « 1 [2]  All
  Print  
Author Topic: Zpub safety  (Read 351 times)
o_e_l_e_o
In memoriam
Legendary
*
Offline Offline

Activity: 2268
Merit: 18509


View Profile
May 30, 2023, 11:21:11 AM
 #21

However, I'm not quite sure how the hex characters correspond to these base58 prefixes.
You can find a list of all the extended key prefixes for both public and private keys here: https://github.com/satoshilabs/slips/blob/master/slip-0132.md#registered-hd-version-bytes
The trust scores you see are subjective; they will change depending on who you have in your trust list.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714607830
Hero Member
*
Offline Offline

Posts: 1714607830

View Profile Personal Message (Offline)

Ignore
1714607830
Reply with quote  #2

1714607830
Report to moderator
NotATether
Legendary
*
Offline Offline

Activity: 1582
Merit: 6718


bitcoincleanup.com / bitmixlist.org


View Profile WWW
May 30, 2023, 12:20:45 PM
 #22

However, I'm not quite sure how the hex characters correspond to these base58 prefixes.
You can find a list of all the extended key prefixes for both public and private keys here: https://github.com/satoshilabs/slips/blob/master/slip-0132.md#registered-hd-version-bytes

Yes I've already consulted SLIP-0132 for my library at least 10 times (no offense).

What's not clear to me is how they choose the version bit hex characters so that they align with the base58 characters, because as you know, 58 is not divisible by 16 so there will be some spillover into the 5th Base58 extended key byte.

Another trapdoor is whether stuff is encoded into base58 starting at the beginning of the string or the end of the string. If only there were an online tool for autogenerating this stuff.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
o_e_l_e_o
In memoriam
Legendary
*
Offline Offline

Activity: 2268
Merit: 18509


View Profile
May 30, 2023, 01:48:04 PM
Merited by NotATether (2)
 #23

Yes I've already consulted SLIP-0132 for my library at least 10 times (no offense).
My bad, I misunderstood.

What's not clear to me is how they choose the version bit hex characters so that they align with the base58 characters, because as you know, 58 is not divisible by 16 so there will be some spillover into the 5th Base58 extended key byte.
The spillover is accounted for within the prefix bytes, so it doesn't spill out beyond this.

For example, if you take an xpub an decode to hex, your first 8 characters will be 0x0488B21E. This is the lower limit. Decrease by 1 to 0x0488B21D and your resulting string will start with "xpua". However, you can increase all the way up to 0x0488B224 and still have an "xpub". So any string which starts with "0x0488B21E" will always be "xpub", since even if every other byte is 0x00 or 0xFF, it still falls within the necessary range. Note that this works only because these strings are of fixed lengths. If you start adding or subtracting bytes, then the process fails.

So let's say I wanted to come up with a hex string which would have a prefix which encoded "oeLeo", followed by 14 bytes. I set my 14 bytes as all zeroes, and arrive at the following string:

Code:
046491a9c30000000000000000000000000000
oeLeo23QDxsqTT6RprgBHmFWP

If I increment my prefix by one, I get the following:

Code:
046491a9c40000000000000000000000000000
oeLeo3fWrUmEpNpaLkZLLXcHu

So I can use the prefix 0x046491a9c3, knowing that every possible value of the following 14 bytes still falls within the necessary range.
Pages: « 1 [2]  All
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!