Friday, November 22, 2024

Encypted Non-public Key -> QR Code

1. A step to DECODE / ENCODE W.I.F. key

A non-public key in WIF (Pockets Import Format) follows this construction when the bottom 58 is decoded:

enter image description here

  • The primary byte (0x80) is right here to point the community sort (On this case it is the primary community). (uint8_t)
  • The 32 subsequent bytes (0x9172e8eec99f144f72eca9a568759580edadb2cfd154857f07e657569493bc44) is your non-public key. (uint8_t[32])
  • The following byte (0x01) is the compression flag. (boolean)
  • The following 4 bytes (0x4739a585) is the checksum of all earlier knowledge. The checksum used is SHA256d. (uint8_t[4])

Instance to create a checksum:

HASH1 = SHA256(80 || 9172e8eec99f144f72eca9a568759580edadb2cfd154857f07e657569493bc44 || 01) (Bytes concatenation)
HASH1 = SHA256(809172e8eec99f144f72eca9a568759580edadb2cfd154857f07e657569493bc4401)
HASH1 = dd777204043c893da5d679703cacd9b7043e11b9b4f7311572759f5902e609cb

HASH2 = SHA256(dd777204043c893da5d679703cacd9b7043e11b9b4f7311572759f5902e609cb)
HASH2 = 4739a585c71b269803c5b5322f30fe01386e705ea8f775b08f6d2c0476d35c97

CHECKSUM = 4739a585

All hashes had been executed with https://emn178.github.io/online-tools/sha256.html (hex possibility)

So now you can encode/decode a WIF key.

Word: to encode in WIF construction, you may have to convert knowledge above in base58 format. So with a view to decode a WIF key, you may have to convert base58 knowledge in bytes like written knowledge above.

2. Partial answer to the issue (QrCode era)

Now you can encode your non-public key in a Pockets Import Format. Then, you’ll create a Qr Code. For instance (with the identical key used above):

WIF = Base58Encode(809172e8eec99f144f72eca9a568759580edadb2cfd154857f07e657569493bc44014739A585)
WIF = L26SjTSxuXTPTv58MfMErY1wiL46D3CqnqvzQj754yZs6RKkfaVi

QrCode era with https://www.barcodesinc.com/generator/qr/.
I typed L26SjTSxuXTPTv58MfMErY1wiL46D3CqnqvzQj754yZs6RKkfaVi and I acquired this:

enter image description here

3. Warnings

  • These steps are helpful when you might have the 32 bytes of personal key. Not when you might have the encrypted non-public key. You might want to decrypt it first with the encryption algorithm through which you encrypted your key. It is a delicate step.
  • I used loads web sites to encode/decode knowledge. This isn’t safe however it was a personal key used as an academic goal solely. I do not recommand you to do the identical factor with actual non-public key. The answer is to make use of a software program. Like others urged, there are many. I will surely recommendation you to make use of sparrow because it offers technical functionnalities.
  • Amongst used web sites, this one can be taught you extra about WIF: https://learnmeabitcoin.com/technical/wif.

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles