Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: Steve2022 on April 14, 2022, 08:29:40 PM



Title: Finding/Extracting Keys from raw Hex data
Post by: Steve2022 on April 14, 2022, 08:29:40 PM
Other post here, but closed.
https://bitcointalk.org/index.php?topic=25091.msg311449#msg311449


Looking for keys on a hard drive.

It says the string below directly proceeds the privkey data

3081 d302 0101 0420

Actually the way my data looks:
30 81 d3 02 01 01 04 20

Can someone help answer a simple question.  The private key that follows this string.  (to the right)    Is the privkey the next 64 characters?

Or 64 x's?

30 81 d3 02 01 01 04 20 xx xx xx xx xx xx xx xx xx xx xx . . .


It also looks like a0 81 85 30 81 82 02 01  is after the privkey

30 81 d3 02 01 01 04 20 xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx a0 81 85 30 81 82 02 01

Is this correct?  Thank You



Title: Re: Finding/Extracting Keys from raw Hex data
Post by: n0nce on April 15, 2022, 03:16:14 AM
A Bitcoin private key is 256 bits or 32 bytes in size. This means 64 characters in hexadecimal (2 hex characters represent a byte).
https://en.bitcoin.it/wiki/Private_key#An_example_private_key

It appears what you found does have 32 bytes of privkey data, so that looks correct indeed.
Quote
30 81 d3 02 01 01 04 20 xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx a0 81 85 30 81 82 02 01

There's more about this topic in this thread (https://bitcointalk.org/index.php?topic=4413938.0) for instance.


Title: Re: Finding/Extracting Keys from raw Hex data
Post by: Steve2022 on April 15, 2022, 04:20:55 AM
Thanks Nonce.  My python script had an error, so my calc was off.  I thought I was missing something.

Even tho the 01 01 04 20 is plenty to find all your keys, There is actually a larger chunk that seems consistent preceding the privkey

    f7 00 01 d6 30 81 d3 02 01 01 04 20


Or that is what I found, all had the exact same data prior, and the a0 81 85 30 81 82 02 01  following