Bitcoin Forum
May 01, 2024, 07:24:56 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Attempting to decode a damaged Base58 WIF to hex  (Read 277 times)
NotATether (OP)
Legendary
*
Offline Offline

Activity: 1582
Merit: 6718


bitcoincleanup.com / bitmixlist.org


View Profile WWW
December 30, 2021, 08:03:17 AM
Merited by Welsh (3), ranochigo (1), ABCbits (1)
 #1

Let's say that x consecutive characters inside a WIF are lost but the rest are known.

Suppose you're trying to get the minimum and maximum possible possible values of this WIF given the missing characters. According to my knowledge, that is supposed to be between 11111..... and zzzzz...... (length depends on how many characters are lost).

Also suppose at first you're dealing with compressed privatekeys, so there's going to be an "01" before the 4 checksum bytes.

This is where things get obnoxious.

Once you decide the WIF (using Base58 - not base58check as that will fail) substituting the lost characters for the smallest and biggest ones, and after removing the checksum and 01 bytes on the right (5) and the "80" byte on the left (1), the hex of the WIF with smaller substituted chars (111111) is larger than the one with bigger subs (zzzzz). How is that possible?

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
1714591496
Hero Member
*
Offline Offline

Posts: 1714591496

View Profile Personal Message (Offline)

Ignore
1714591496
Reply with quote  #2

1714591496
Report to moderator
1714591496
Hero Member
*
Offline Offline

Posts: 1714591496

View Profile Personal Message (Offline)

Ignore
1714591496
Reply with quote  #2

1714591496
Report to moderator
There are several different types of Bitcoin clients. The most secure are full nodes like Bitcoin Core, which will follow the rules of the network no matter what miners do. Even if every miner decided to create 1000 bitcoins per block, full nodes would stick to the rules and reject those blocks.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714591496
Hero Member
*
Offline Offline

Posts: 1714591496

View Profile Personal Message (Offline)

Ignore
1714591496
Reply with quote  #2

1714591496
Report to moderator
Coding Enthusiast
Legendary
*
Offline Offline

Activity: 1039
Merit: 2783


Bitcoin and C♯ Enthusiast


View Profile WWW
December 30, 2021, 08:56:47 AM
Merited by NotATether (5), Welsh (4), ABCbits (4), o_e_l_e_o (4), ranochigo (2), hugeblack (2), AdolfinWolf (2), BlackHatCoiner (2)
 #2

the "80" byte on the left
Because the byte you discarded wasn't 0x80.
When you are treating the Base-58 string as an integer ignoring the checksum, etc. you have to be careful not to hit an edge case such as the one in that other topic.

When you are decoding Kw111... you end up with {0x79, 0x76, ...} bytes which is obviously an invalid permutation because of invalid version byte. So you have to increment until you get to 0x80 first and use that as your starting point. Meaning: Kw1111111112 -> Kw1111111113 -> Kw1111111114 -> ... Kw111111111z -> Kw1111111121 -> Kw1111111122 ...
If you don't do that, your "big" value using z's (Kwzzz...) would be {0x80, 0x4c, ...} and since an integer starting with 0x76 is bigger than an integer starting with 0x4c you end up with a bigger start than the end.

Projects List+Suggestion box
Donate: 1Q9s or bc1q
|
|
|
FinderOuter(0.19.1)Ann-git
Denovo(0.7.0)Ann-git
Bitcoin.Net(0.26.0)Ann-git
|
|
|
BitcoinTransactionTool(0.11.0)Ann-git
WatchOnlyBitcoinWallet(3.2.1)Ann-git
SharpPusher(0.12.0)Ann-git
NotATether (OP)
Legendary
*
Offline Offline

Activity: 1582
Merit: 6718


bitcoincleanup.com / bitmixlist.org


View Profile WWW
December 30, 2021, 09:06:16 AM
 #3

the "80" byte on the left
Because the byte you discarded wasn't 0x80.
When you are treating the Base-58 string as an integer ignoring the checksum, etc. you have to be careful not to hit an edge case such as the one in that other topic.

When you are decoding Kw111... you end up with {0x79, 0x76, ...} bytes which is obviously an invalid permutation because of invalid version byte. So you have to increment until you get to 0x80 first and use that as your starting point. Meaning: Kw1111111112 -> Kw1111111113 -> Kw1111111114 -> ... Kw111111111z -> Kw1111111121 -> Kw1111111122 ...
If you don't do that, your "big" value using z's (Kwzzz...) would be {0x80, 0x4c, ...} and since an integer starting with 0x76 is bigger than an integer starting with 0x4c you end up with a bigger start than the end.

I see.

This means that I have to find the first K..... compressed PK that makes an 0x80 version byte and that's going to correspond to the private key 0x1, right?

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

Activity: 952
Merit: 1367


View Profile
December 30, 2021, 09:21:20 AM
Merited by Welsh (6), hugeblack (5), NotATether (5), ABCbits (2)
 #4

Maybe you must take into account correct boundaries?
uncompressed minimum:
5HpHagT65TZzG1PH3CSu63k8DbpvD8s5ip4nEB3kEsreAnchuDf
compressed minimum:
KwDiBf89QgGbjEhKnhXJuH7LrciVrZi3qYjgd9M7rFU73sVHnoWn

uncompressed maximum:
5Km2kuu7vtFDPpxywn4u3NLpbr5jKpTB3jsuDU2KYEqetqj84qw
compressed maximum:
L5oLkpV3aqBjhki6LmvChTCV6odsp4SXM6FfU2Gppt5kFLaHLuZ9

On the other hand:
Where are the missing characters? How many? If you think about converting WIF solving into tools like bitCrack, it is not always possible - only for characters on very left side (at the beginning), where stride is >= then 58^40 (maybe one character more on right, I do not remember now).
Otherwise stride will collide with checksum (and/or compression flag) and then it is not linear - not possible to use BitCrack!

If you need other help, for example with configuring my WifSolver, let me know.
Coding Enthusiast
Legendary
*
Offline Offline

Activity: 1039
Merit: 2783


Bitcoin and C♯ Enthusiast


View Profile WWW
December 30, 2021, 09:30:12 AM
 #5

This means that I have to find the first K..... compressed PK that makes an 0x80 version byte and that's going to correspond to the private key 0x1, right?
Yes, that would make the starting point. Although brute forcing it may take a long time itself since it is 10 missing characters so you may need to find the closest thing by manually modifying the characters.

Projects List+Suggestion box
Donate: 1Q9s or bc1q
|
|
|
FinderOuter(0.19.1)Ann-git
Denovo(0.7.0)Ann-git
Bitcoin.Net(0.26.0)Ann-git
|
|
|
BitcoinTransactionTool(0.11.0)Ann-git
WatchOnlyBitcoinWallet(3.2.1)Ann-git
SharpPusher(0.12.0)Ann-git
stanner.austin
Member
**
Offline Offline

Activity: 67
Merit: 53


View Profile
December 30, 2021, 11:29:09 AM
 #6

i have made some test too.

sample "01" WIF key compressed "KwDiBf89QgGbjEhKnhXJuH7LrciVrZi3qYjgd9M7rFU73sVHnoWn"
sample used is "KwDiBf****GbjEhKnhXJuH7LrciVrZi3qYjgd9M7rFU73sVHnoWn"

Code:
Found 800000000000000000000000000000000000000000000000000000000000000001014671fc3f
Found KwDiBf89QgGbjEhKnhXJuH7LrciVrZi3qYjgd9M7rFU73sVHnoWn
--- 80.92910385131836 seconds ---
         86432970 function calls (86432959 primitive calls) in 80.933 seconds

only 4 digit recovery take 80sec signal core, cpu use intel7 10gen to try all 0 to 58 digit from base58 index.
no idea how much it will take for 10 digits. but for sure not good for CPU.. GPU may help on this.
NotATether (OP)
Legendary
*
Offline Offline

Activity: 1582
Merit: 6718


bitcoincleanup.com / bitmixlist.org


View Profile WWW
December 31, 2021, 01:37:51 PM
 #7

Thanks for the answers.

In particular, is the WIF that begins with: "L1111111111......." a valid private key? Leaving out all the checksum bytes of course so those can be anything. I just want to know if it's valid to place a sequence of 1's inside a private key WIF (I read somewhere that that may not be the case for addresses), as the number "1" in base58 is equal to the number "0" in base10.

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

Activity: 952
Merit: 1367


View Profile
December 31, 2021, 05:14:33 PM
 #8

Thanks for the answers.

In particular, is the WIF that begins with: "L1111111111......." a valid private key? Leaving out all the checksum bytes of course so those can be anything. I just want to know if it's valid to place a sequence of 1's inside a private key WIF (I read somewhere that that may not be the case for addresses), as the number "1" in base58 is equal to the number "0" in base10.

Of course. It is just a text in given encoding. It is only our (people) ability to find patterns which looks "nice"...
WIF L111111111111111111111111111111111111111111111CbeH6a is fully correct, leads to private key
70cfa0d40309798a5bd144a396478b5b5ae3305b7413601b18767666bdb2f800
which is key like any other...
Some strings looks "nice" in binary, others in hex and others in base58 encoding....
NotATether (OP)
Legendary
*
Offline Offline

Activity: 1582
Merit: 6718


bitcoincleanup.com / bitmixlist.org


View Profile WWW
December 31, 2021, 05:40:43 PM
 #9

Of course. It is just a text in given encoding. It is only our (people) ability to find patterns which looks "nice"...
WIF L111111111111111111111111111111111111111111111CbeH6a is fully correct, leads to private key
70cfa0d40309798a5bd144a396478b5b5ae3305b7413601b18767666bdb2f800
which is key like any other...
Some strings looks "nice" in binary, others in hex and others in base58 encoding....


Also, is the checksum always going to be six base58 characters like this one?

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

Activity: 952
Merit: 1367


View Profile
December 31, 2021, 05:49:14 PM
 #10

Not really. The rule is that checksum takes last 8 hex characters of decoded WIF. And for compressed there are also 2 characters of compression flag. All together may takes in general last 5 characters of WIF and very often also 6th character. All depends on values of checksum and flag, and how they are convertible to base58.
In my WifSolver for wifs with missing end I think I made assumption that last 5 characters are not important (are checksum).

pooya87
Legendary
*
Offline Offline

Activity: 3444
Merit: 10521



View Profile
January 01, 2022, 04:58:22 AM
Merited by hugeblack (1)
 #11

(I read somewhere that that may not be the case for addresses), as the number "1" in base58 is equal to the number "0" in base10.
It is the first digit so it represents 0 but you may be thinking of the starting 1s like 1abc in which case it is replaced with a zero when decoding (or 1 is added for each starting zero) and we do it because in this encoding we convert an integer to the base58 and vice versa, it is important to know the number of zeros it had at the beginning or we may end up with a shorter invalid result.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
cixegz
Newbie
*
Offline Offline

Activity: 13
Merit: 0


View Profile
January 01, 2022, 12:59:51 PM
Last edit: January 01, 2022, 02:19:46 PM by cixegz
 #12

i speak little bit englsih
@NotATether help me this is your post 10/10/21 i need tips and python code

@pooya87 thanks i am open new topic solve this any one i will donate 2022$
click read my topic https://bitcointalk.org/index.php?topic=5379443.msg58874670#msg58874670
pooya87
Legendary
*
Offline Offline

Activity: 3444
Merit: 10521



View Profile
January 01, 2022, 01:37:10 PM
 #13

for any random public key add,sub.div,multple output is unknow 3rd publickey (x,y)ok,
You can add 2 points (public keys) or subtract them but you can not multiply or divide two points.
You can multiply or divide a point with a number but you can't add or subtract an integer from a point.

Maybe if you explain what you want to achieve with these operations we can help you better.

Quote
any one solve this problom i well donate for you 2022$ ==  0.043 current btc price #
Place the 0.043BTC with an escrow and open a new topic in the services board.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
mynonce
Full Member
***
Offline Offline

Activity: 233
Merit: 253


View Profile
January 02, 2022, 01:48:10 AM
 #14

any one solve this problom i well donate for you 2022$ ==  0.043 current btc price #
Place the 0.043BTC with an escrow and open a new topic in the services board.

solved ...

...
iknow random private key: how to find y is small range or big range  atleast guess Undecided
...
If you have a private key, you can't know whether your y coordinate is in small range or big range before calculating it.
There is no relationship between your public key y value and your private key. Else you would be able to calculate the private key with the public key.
Or we could say:
... It is impossible ... because then ECDSA would be broken.

As of today 01/01/2022  Smiley
Pages: [1]
  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!