<h2>1. A step to DECODE / ENCODE W.I.F. key</h2>
<p>A private key in WIF (Wallet Import Format) follows this structure when the base 58 is decoded:</p>
<p><a href="https://i.sstatic.net/Y9M7i.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Y9M7i.png" alt="enter image description here" /></a></p>
<ul>
<li>The first byte (0x80) is here to indicate the network type (In this case it's the main network). <strong>(uint8_t)</strong></li>
<li>The 32 next bytes (0x9172e8eec99f144f72eca9a568759580edadb2cfd154857f07e657569493bc44) is your private key. <strong>(uint8_t[32])</strong></li>
<li>The next byte (0x01) is the compression flag. <strong>(boolean)</strong></li>
<li>The next 4 bytes (0x4739a585) is the checksum of all previous data. The checksum used is <strong>SHA256d</strong>. <strong>(uint8_t[4])</strong></li>
</ul>
<p>Example to create a checksum:</p>
<pre><code>HASH1 = SHA256(80 || 9172e8eec99f144f72eca9a568759580edadb2cfd154857f07e657569493bc44 || 01) (Bytes concatenation)
HASH1 = SHA256(809172e8eec99f144f72eca9a568759580edadb2cfd154857f07e657569493bc4401)
HASH1 = dd777204043c893da5d679703cacd9b7043e11b9b4f7311572759f5902e609cb

HASH2 = SHA256(dd777204043c893da5d679703cacd9b7043e11b9b4f7311572759f5902e609cb)
HASH2 = 4739a585c71b269803c5b5322f30fe01386e705ea8f775b08f6d2c0476d35c97

CHECKSUM = 4739a585
</code></pre>
<p>All hashes were done with <a href="https://emn178.github.io/online-tools/sha256.html" rel="nofollow noreferrer">https://emn178.github.io/online-tools/sha256.html</a> (hex option)</p>
<p>So you can now encode/decode a WIF key.</p>
<p><strong>Note:</strong> to encode in WIF structure, you'll need to convert data above in base58 format. So in order to decode a WIF key, you'll need to convert base58 data in bytes like written data above.</p>
<h2>2. Partial solution to the problem (QrCode generation)</h2>
<p>You can now encode your private key in a Wallet Import Format. Then, you'll be able to create a Qr Code. For example (with the same key used above):</p>
<pre><code>WIF = Base58Encode(809172e8eec99f144f72eca9a568759580edadb2cfd154857f07e657569493bc44014739A585)
WIF = L26SjTSxuXTPTv58MfMErY1wiL46D3CqnqvzQj754yZs6RKkfaVi
</code></pre>
<p>QrCode generation with <a href="https://www.barcodesinc.com/generator/qr/" rel="nofollow noreferrer">https://www.barcodesinc.com/generator/qr/</a>.
I typed <code>L26SjTSxuXTPTv58MfMErY1wiL46D3CqnqvzQj754yZs6RKkfaVi</code> and I got this:</p>
<p><a href="https://i.sstatic.net/OzAde.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/OzAde.png" alt="enter image description here" /></a></p>
<h2>3. Warnings</h2>
<ul>
<li>These steps are useful when you have the 32 bytes of private key. Not when you have the <strong>encrypted</strong> private key. You need to decrypt it first with the encryption algorithm in which you encrypted your key. This is a delicate step.</li>
<li>I used a lot websites to encode/decode data. This is not secure but it was a private key used as an educational purpose only. I don't recommand you to do the same thing with real private key. The solution is to use a software. Like others suggested, there are plenty of. I would certainly advice you to use sparrow since it provides technical functionnalities.</li>
<li>Among used websites, this one can learn you more about WIF: <a href="https://learnmeabitcoin.com/technical/wif" rel="nofollow noreferrer">https://learnmeabitcoin.com/technical/wif</a>.</li>
</ul>

CC BY-SA 4.0
2023-08-15T08:06:28.710Z
2023-08-15T08:14:49.523Z
2023-08-15T08:14:49.523Z
Loopite
<p>You need a wallet software that supports decrypting private keys. Like Electrum.</p>

CC BY-SA 4.0
2023-08-15T06:20:19.423Z
2023-08-15T06:20:19.423Z
Mani T
<p>use bitaddress.org for creating your paper wallet,it gives you the option of encrypting your private key (BIP38) and then print the whole wallet (address,pub key,encrypted private key) plus a QR code.</p>

CC BY-SA 3.0
2017-08-07T16:14:35.647Z
No, this does not help me. I need to decrypt an existing private key. I tried using bitaddress but I can only encrypt said key
Marc HPunkt
CC BY-SA 3.0
2017-08-07T16:29:29.453Z
so do this,create a blockchain.info wallet, then go to settings , addresses, then click on 'Import" , a new box will pop up for you to enter your encrypted private key, enter it manually, if it is in correct format it will ask you for your passphrase. then it will import your address and its balance to your wallet.
WalterMitty
CC BY-SA 3.0
2017-08-07T13:27:29.243Z
2017-08-07T13:27:29.243Z
WalterMitty
<p>I have a paper wallet with a public address and an encrypted private key ( with a passphrase ), but no QR code. So I need a way to generate a QR image, or manually input the key. </p>

<p>Sadly QR generators wont accept my encrypted private key. So I need to decrypt it first. </p>

<p>Is there any way I can decrypt my private key using my passphrase and then covert it into a QR code?</p>

<p>Best.</p>

<private-key><private-key-export><qrcode>
Encypted Private Key -> QR Code
Marc HPunkt
# Encypted Private Key -> QR Code

(Asked by: username_0 on 2017-08-07)

I have a paper wallet with a public address and an encrypted private key ( with a passphrase ), but no QR code. So I need a way to generate a QR image, or manually input the key.

Sadly QR generators wont accept my encrypted private key. So I need to decrypt it first.

Is there any way I can decrypt my private key using my passphrase and then covert it into a QR code?

Best.

**Tags:** private-key, private-key-export, qrcode


---

## 3 answers

### Answer by username_1 on 2023-08-15. Score: 0

1. A step to DECODE / ENCODE W.I.F. key
A private key in WIF (Wallet Import Format) follows this structure when the base 58 is decoded:


The first byte (0x80) is here to indicate the network type (In this case it's the main network). (uint8_t)
The 32 next bytes (0x9172e8eec99f144f72eca9a568759580edadb2cfd154857f07e657569493bc44) is your private key. (uint8_t[32])
The next byte (0x01) is the compression flag. (boolean)
The next 4 bytes (0x4739a585) is the checksum of all previous data. The checksum used is SHA256d. (uint8_t[4])

Example 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 were done with https://emn178.github.io/online-tools/sha256.html (hex option)
So you can now encode/decode a WIF key.
Note: to encode in WIF structure, you'll need to convert data above in base58 format. So in order to decode a WIF key, you'll need to convert base58 data in bytes like written data above.
2. Partial solution to the problem (QrCode generation)
You can now encode your private key in a Wallet Import Format. Then, you'll be able to create a Qr Code. For example (with the same key used above):
WIF = Base58Encode(809172e8eec99f144f72eca9a568759580edadb2cfd154857f07e657569493bc44014739A585)
WIF = L26SjTSxuXTPTv58MfMErY1wiL46D3CqnqvzQj754yZs6RKkfaVi

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

3. Warnings

These steps are useful when you have the 32 bytes of private key. Not when you have the encrypted private key. You need to decrypt it first with the encryption algorithm in which you encrypted your key. This is a delicate step.
I used a lot websites to encode/decode data. This is not secure but it was a private key used as an educational purpose only. I don't recommand you to do the same thing with real private key. The solution is to use a software. Like others suggested, there are plenty of. I would certainly advice you to use sparrow since it provides technical functionnalities.
Among used websites, this one can learn you more about WIF: https://learnmeabitcoin.com/technical/wif.


---

### Answer by username_2 on 2023-08-15. Score: 0

You need a wallet software that supports decrypting private keys. Like Electrum.


---

### Answer by username_3 on 2017-08-07. Score: 0

use bitaddress.org for creating your paper wallet,it gives you the option of encrypting your private key (BIP38) and then print the whole wallet (address,pub key,encrypted private key) plus a QR code.

> **Comments:**
> **username_0**: No, this does not help me. I need to decrypt an existing private key. I tried using bitaddress but I can only encrypt said key  
> **username_3**: so do this,create a blockchain.info wallet, then go to settings , addresses, then click on 'Import" , a new box will pop up for you to enter your encrypted private key, enter it manually, if it is in correct format it will ask you for your passphrase. then it will import your address and its balance to your wallet.  

---

