FM-39 · Seed phrase concealmentDistribution: unlimited. Copy freely.
Bitcoin Seed BookSelf-custody field manual

Encrypting a seed with a password: BIP-38, GPG and age

Home » Resources » Encrypting a seed with a password: BIP-38, GPG and age

The ciphers on this site are disguises. This page is about real encryption: a program takes your secret and a password and produces ciphertext that nobody can read without the password. It works. It also moves the problem somewhere else, and it asks you to type your seed into a computer.

Hiding is not encrypting. The ciphers are public and a seed phrase carries its own checksum, so a list someone recognises as a seed can be tried against every cipher in minutes. Password encryption is the real thing, but it is only as strong as the password, and a BIP-39 passphrase gives you the same lock inside the wallet with no extra tool.

Three tools

BIP-38

BIP-38 encrypts one Bitcoin private key with a passphrase. The result is a 58-character string that always starts with 6P. It was written for paper wallets, where one key held one address.

It doesn't encrypt a seed phrase. Take the public example:

pizza educate fat kiss domain venue kingdom raise split step copper tree (this phrase is public: never use it for real funds)

Those words generate a whole tree of keys, and BIP-38 has a slot for exactly one of them. If your wallet has twelve or twenty-four words, BIP-38 is the wrong tool.

Its password stretching is scrypt with N=16384, r=8, p=8. The record also stores a 4-byte hash of the address in the clear, so a wrong password is caught instead of producing a different key. The BIP points out the side effect: someone without the password can use that hash to guess which address the record belongs to.

GnuPG symmetric mode

GnuPG (GPG) can encrypt any file with a password alone, no key pair. The manual gives AES-256 as the default cipher. The password is stretched by the OpenPGP iterated-and-salted method, which by default hashes it over and over with SHA-1. The number of rounds is calibrated by gpg-agent so that stretching one password takes about 100 milliseconds on the machine doing the encrypting.

Two details from the manual matter here. GPG caches the passphrase used for symmetric encryption, so a later decrypt on the same machine may not ask for it again, and anyone at that machine gets the same convenience. And the top cipher in your personal preferences overrides the default, so what gets written depends on how that machine is set up.

age

age is a small file-encryption tool with a published format, age-encryption.org/v1. In passphrase mode it offers to generate a passphrase for you if you leave the prompt empty. The password goes through scrypt with r=8 and p=1. The work factor is written into the file; the reference version uses 2^18 and its source notes that this takes about a second on a modern machine. The file itself is encrypted with ChaCha20-Poly1305, which is authenticated, so a wrong password fails with an error instead of decrypting to garbage.

The password is the new seed

Encrypting a seed doesn't remove a secret. It adds one. Before, you had twelve words to protect. After, you have a ciphertext and a password, and the password is the part that decides everything. It mustn't be lost, forgotten or found.

So you now face every question this site asks about seeds, about the password instead:

  1. Where is it written down? A password that only lives in your head dies with you.
  2. Is that place separate from the ciphertext? If they're found together, the encryption bought nothing.
  3. Does anyone else know how to use it? Your heirs need the password, the file, the tool and the knowledge of which tool it was.

That is the key-management regress. Each layer of encryption needs a key, and the key needs a backup. Somewhere the chain ends in something written on paper or held in a head, and that end is where your real security sits.

The seed has to touch a computer

All three tools run on a general-purpose computer. To encrypt a seed, you type it into one. This site treats that as exposure: keyloggers, clipboard history, swap files, cloud-synced folders and screenshots all live there (camera, screen and clipboard leaks covers the list).

The only version we'd accept is a machine that never goes online, before or after, and gets wiped when you're done. Most people don't own one. A laptop with the Wi-Fi switched off for an afternoon is not one.

And never use a website that offers to encrypt a seed or a key for you. Whatever the page promises, the words reach somebody else's code.

What a guess costs

Encryption with a password can always be attacked by guessing the password. The key-stretching function sets the price of each guess:

Tool Stretching Per guess, as shipped
BIP-38 scrypt N=16384, r=8, p=8 about 16 MiB of memory, worked 8 times
age scrypt N=2^18, r=8, p=1 about 256 MiB of memory, about a second
GnuPG iterated SHA-1, calibrated about 100 ms, little memory

The memory figures follow from scrypt's design in RFC 7914: one 128×r-byte block for each of the N steps. The RFC calls scrypt memory-hard: the memory is there to give added protection against attacks with custom hardware. GnuPG's iterated hash has no memory cost at all. RFC 9106 recommends Argon2id with 2 GiB of memory for a password hash, or 64 MiB with three passes where memory is short. None of these three tools uses Argon2.

The stretching only multiplies the work. It can't rescue a weak password. A password you made up in your head, with a name or a year in it, falls to a dictionary attack whatever the function. Use six or more random words chosen with dice, the same standard as the 25th word.

Software rot

A paper seed in BIP-39 words can be read by any BIP-39 wallet, because the standard and the word list are fixed. A ciphertext is readable only by a program that still understands its format, on a machine that still runs it.

Ask the 20-year question before you rely on one:

  • GnuPG is a large program with many options, and what it writes depends on its settings. Record which ones you used.
  • age has a short written specification, so another program could be written from it. Its first stable release was in September 2021, which is a short track record for a 20-year plan.
  • BIP-38 has a fixed format, but it only helps if a wallet you can still get will import a 6P key.

Whichever you choose, store a note of the tool and the format next to the ciphertext. Store a copy of the tool itself somewhere too.

When it's still worth doing

Encryption earns its keep when a digital copy has to exist anyway: a backup file a wallet exports, a descriptor or wallet file that holds more than the seed, an archive you keep in several places. Then encrypting it with a strong password, generated by the tool where it can, is far better than storing it bare. Do the encrypting on the offline machine described above, and test the decrypt before you rely on it.

For the twelve or twenty-four words themselves, compare it with a BIP-39 passphrase:

Password encryption BIP-39 passphrase
Extra tool Yes, and it must still exist No, it is part of BIP-39
Seed typed into a computer Yes No, the signer does it
Wrong password Error Opens a different, empty wallet
What you must back up Ciphertext, password, tool Words, passphrase

The passphrase wins for most people. It does the same job inside the signer, needs no software you'll have to find again in 2046, and never puts the words on a computer. The one thing encryption does better is tell you when you've typed the password wrong; the passphrase answers that with a fingerprint check.

If what worries you is one copy being found, a split across places or Shamir shares spreads the risk with no password to lose, and a passphrase also lets you keep decoy wallets.

We will never ask for a seed word or a passphrase. Never type one into this site or any tool it links to.

Sources