Friday, November 22, 2024

pockets restoration – How can I discover a Bitcoin personal key that I saved in a textual content file?

In case you’re programming savvy you can write a small program that searches for the common expression of a Bitcoin personal key. Bitcoin personal keys have a really particular format:

They’re 51 keys lengthy, begin with a ‘5’ and the second letter is both ‘H’, ‘J’, or ‘Okay’ and use base58 for the remaining 49 letters which excludes the characters 0IOl.

It appears to me that the next common expression ought to work to seek out an uncompressed personal key:
5[HJK][1-9A-HJ-NP-Za-km-z]{49} (inspiration: Stackoverflow).

Later, one other format was launched for compressed keys, which has 52 base58 characters, and begins with a ‘Okay’ or ‘L’. For that format, it’s best to be capable of use the next common expression:

[KL][1-9A-HJ-NP-Za-km-z]{51}

Notice that common expressions can use barely various syntax, so that you may have to adapt the expression to the programming language or software that you just use. You’ll be able to generate a couple of personal keys, e.g. with bitaddress.org for testing materials. It is best to most likely be simpler in the event you embrace phrase boundary b symbols earlier than and after the expression.

In case you’re on a Unix system, these grep instructions would discover uncompressed and compressed personal keys recursively from the listing you are calling from:

grep -r 'b5[HJK][1-9A-HJ-NP-Za-km-z]{49}b' *
grep -r 'b[KL][1-9A-HJ-NP-Za-km-z]{51}b' *

Or seek for each of them with this mixed sample:

grep -r 'b[5KL][1-9A-HJ-NP-Za-km-z]{50,51}b' *

To make use of grep on Home windows, you can maybe discover a resolution right here: What are good grep instruments for Home windows?

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles