Guide · Encryption

What is PBKDF2 key derivation? Why a passphrase becomes a key slowly

Key derivation is the step that turns a password or passphrase into an encryption key. PBKDF2 does it by running a hash function over the phrase and a random salt over and over (Sealed’s vault passphrase uses 1,000,000 rounds), so making the key takes a noticeable moment. You wait once per unlock; someone guessing waits that long for every guess. It slows guessing down. It cannot rescue a phrase that is easy to guess in the first place.

Last checked

On this page

The problem key derivation solves

A cipher needs a key: a long run of random bits. People can’t remember that. They can remember a phrase. Key derivation is the bridge. It takes the phrase and produces a key of the right size, the same key every time for the same phrase. NIST’s recommendation on the subject calls this deriving “master keys from passwords or passphrases”.

The bridge has a weak point. If making the key were instant, a guesser with a copy of your locked file could try millions of phrases a second. So a good derivation is slow on purpose.

How PBKDF2 works, in plain steps

  1. Take the phrase and a salt. The salt is a random value made when you set the phrase, stored openly next to the locked data.
  2. Hash them together. A hash function, such as the one in the OWASP table, mixes them into a short, fixed-size output.
  3. Hash the result again, and again. Each repeat is a round. The final output, after all rounds, is the key.
  4. Use the key. It unlocks the data, or it fails, and that failure is the only answer a guesser gets.

To check one guess, a guesser has to do all the rounds too. There is no shortcut.

What the rounds buy you

A plain hash is fast. The OWASP cheat sheet says fast hashes such as SHA-256 alone are not suitable because they let attackers make large numbers of guesses quickly. Rounds multiply that cost.

Think of it as a toll. If one guess costs a fraction of a second, you pay that once when you unlock and never notice. A guesser who wants to try a long list pays it for every name on the list. OWASP’s current figure for this function is in its table, and it advises keeping each hash under a second.

What the salt is for

Without a salt, two people with the same phrase would get the same key, and a guesser could compute a big table once and reuse it on everyone. A random salt makes each key one of a kind. The guesser has to start from scratch for each file. The salt is stored in the open: its whole job is to be different.

What it can’t fix

Rounds stretch the time per guess. They do not make a short list long. If your phrase is your pet’s name, it sits near the top of every guess list, and it falls on an early try no matter how slow each try is.

So key derivation and a good phrase work as a pair. Random words from a long list give the guesser nothing to aim at. The guide to choosing a strong passphrase covers that half. For short numeric codes, the defence is a different one: waits between tries, covered in how long it takes to guess a passcode.

Where you meet it

  • Encrypted backups and archives that open with a password.
  • Password managers, which derive the key for your vault from your main password.
  • Disk encryption on a computer.
  • Apps that let you lock data with a phrase, such as a vault passphrase or a password-locked file you send someone.

If a product says it encrypts with your password, ask two things: which derivation function, and how many rounds. A product that can answer has thought about guessing.

Where Sealed helps, and where it doesn’t

It helps when you set a vault passphrase: The vault key is sealed with AES-GCM under a key made from the passphrase by PBKDF2-HMAC-SHA256 at 1,000,000 rounds. The key made from a vault passphrase uses a random 16-byte salt, stored next to the sealed vault key. The vault passphrase page shows the setup.

It helps with the same slow step for a sealed copy of your recovery key and for shares you send. A sealed copy is a block of 175 letters and numbers, locked with AES-256-GCM under a key made from your phrase by PBKDF2-HMAC-SHA256 at 1,000,000 rounds. A share is locked with a key made from its passphrase by PBKDF2-HMAC-SHA256 at 600,000 iterations, then encrypted the same way as the vault.

It doesn’t derive the vault key from your everyday passcode. Your vault key is a random 256-bit key. It is not made from your passcode. Your passcode is a gate in front of the app. It is not part of the key.

It doesn’t make a weak phrase strong. That is why it asks for a strong one: Sealed asks for a passphrase rated Strong, and suggests a few unrelated words.

Questions and answers

Is PBKDF2 the same as encryption?

No. PBKDF2 only makes a key. A cipher then uses that key to lock the data. In Sealed’s vault passphrase both steps appear in one line: The vault key is sealed with AES-GCM under a key made from the passphrase by PBKDF2-HMAC-SHA256 at 1,000,000 rounds.

Why not just use more rounds?

Every round you add, you also wait for at each unlock, and an older phone waits longest. Designers pick a number that feels quick to you and slow to a guesser. In Sealed: Sealed’s passphrase rounds are set to take about half a second on a recent iPhone.

Is a newer function better than PBKDF2?

Functions such as scrypt and Argon2 also use a lot of memory, which makes guessing on graphics cards more expensive. The older function is widely built in, and with enough rounds it is still a sound choice. The vault key is sealed with AES-GCM under a key made from the passphrase by PBKDF2-HMAC-SHA256 at 1,000,000 rounds.

Sources

What this page says about Sealed was checked against the app on .

Last checked:

Get Sealed

Sealed is free to download, and Sealed Pro is an optional in-app purchase.