FILE G2 / CRYPTOGRAPHY
PBKDF2 Explained: The Password-Based Key Derivation Function That Secures Your Vault
PBKDF2 is the most widely deployed password-based key derivation function in the world. It turns a human-memorable password into a cryptographic key that can withstand brute-force attacks. This article explains how PBKDF2 works, why direct hashing is insufficient, the role of salts and iteration counts, and how AppVault uses PBKDF2 with 600,000 iterations of SHA-256 to protect your files.
UPDATED · 2026-05-16 · REVIEWED BY APPVAULT
TL;DR
PBKDF2 (Password-Based Key Derivation Function 2) is a key stretching algorithm defined in RFC 2898. It applies a pseudorandom function (typically HMAC-SHA256) many times to a password and a salt, producing a derived key. The iteration count makes brute-force attacks exponentially more expensive. OWASP recommends 600,000 iterations for SHA-256 as of 2026. AppVault uses PBKDF2 with 600,000 iterations, a per-install 128-bit salt, and wraps the output with a Secure Enclave key for hardware-bound protection.
Every time you unlock your iPhone, enter a password on a website, or open a file vault, a piece of software turns your secret into a cryptographic key. That transformation is not a simple hash. It is a carefully designed function that makes brute-force attacks expensive. The most widely deployed of these functions is PBKDF2.
PBKDF2 stands for Password-Based Key Derivation Function 2. It is defined in RFC 2898 (PKCS #5 v2.0) and has been a NIST-recommended standard for over two decades. It takes a password, a salt, an iteration count, and a desired key length, and produces a derived key that can be used for encryption, authentication, or other cryptographic operations.
This article explains how PBKDF2 works, why direct hashing is insufficient, the role of salts and iteration counts, the OWASP 2026 recommendation of 600,000 iterations for SHA-256, and how PBKDF2 compares to modern alternatives like Argon2id, bcrypt, and scrypt. It also describes how AppVault uses PBKDF2 as part of its encryption stack.
Why Direct Hashing Fails
If you take a password and compute its SHA-256 hash, you get a 256-bit value. That value can be used as a key. The problem is speed. A modern GPU can compute billions of SHA-256 hashes per second. An attacker with a single consumer GPU can try every 8-character lowercase password in a few minutes.
Direct hashing also has no built-in protection against precomputation. Without a salt, the same password always produces the same hash. Attackers can build rainbow tables — precomputed hash chains — and look up the hash to recover the password instantly.
PBKDF2 solves both problems. It repeats the hash thousands of times, making each attempt computationally expensive. It requires a salt, so identical passwords produce different keys. The combination of iteration count and salt turns a fast hash into a slow, unique derivation.
How PBKDF2 Works
PBKDF2 is built on a pseudorandom function (PRF), typically HMAC-SHA256 or HMAC-SHA1. The algorithm works as follows:
- The password and salt are combined.
- The PRF is applied to the salt concatenated with a block counter (for key lengths longer than the PRF output).
- The output is XORed with the result of the previous iteration (for the first iteration, the previous result is the PRF output itself).
- Steps 2-3 are repeated for the specified number of iterations.
- The final output is the derived key.
The iteration count is the critical parameter. Each iteration adds a fixed amount of work. If an attacker wants to test a password, they must run the entire chain of iterations. With 600,000 iterations, a single password attempt takes roughly 600,000 times longer than a single SHA-256 hash.
The salt must be unique per user or per instance. A 128-bit salt (16 bytes) is the minimum recommended by NIST. The salt is stored alongside the derived key (or in the vault metadata) so that the derivation can be repeated during authentication.
The OWASP 2026 Recommendation
OWASP publishes a Password Storage Cheat Sheet that provides iteration count recommendations for various key derivation functions. As of 2026, the recommendation for PBKDF2-HMAC-SHA256 is 600,000 iterations. For PBKDF2-HMAC-SHA1, the recommendation is 1,300,000 iterations, because SHA1 produces a 160-bit output and is slightly faster per iteration.
These numbers are not arbitrary. They are calibrated so that a single password attempt takes roughly 0.1 seconds on modern consumer hardware. That delay is imperceptible to a legitimate user but makes brute-force attacks prohibitively slow. An attacker with a cluster of 100 GPUs can attempt only a few hundred passwords per second, not billions.
The iteration count should be increased over time as hardware improves. OWASP updates its recommendations periodically. AppVault uses 600,000 iterations for PBKDF2-HMAC-SHA256, matching the 2026 guideline.
Tradeoffs of Iteration Count
Higher iteration counts make brute-force attacks harder, but they also increase the time required to derive the key on the legitimate device. On an iPhone, 600,000 iterations of HMAC-SHA256 take about 0.2 seconds. That is acceptable for a vault unlock. But if the iteration count were raised to 10 million, the unlock time would exceed 3 seconds, degrading user experience.
There is also a power consumption tradeoff. Mobile devices have limited battery. Each iteration consumes CPU cycles. AppVault balances security and usability by choosing an iteration count that provides strong protection without draining the battery or frustrating the user.
Another tradeoff is memory usage. PBKDF2 is not memory-hard. It uses a small, fixed amount of memory regardless of the iteration count. This makes it vulnerable to GPU and ASIC attacks that can parallelize many password attempts. Memory-hard functions like Argon2id and scrypt require a large amount of memory per attempt, making parallel attacks much more expensive. PBKDF2 compensates for its lack of memory hardness with a high iteration count and, in AppVault’s case, hardware binding via the Secure Enclave.
PBKDF2 vs. Argon2id, bcrypt, and scrypt
PBKDF2 is not the only password-based key derivation function. Three other functions are commonly used: bcrypt, scrypt, and Argon2id. Each has different design goals and security properties.
Bcrypt was designed in 1999 and uses a Blowfish-based key schedule. It is resistant to GPU attacks because it requires a fixed amount of memory (4 KB) and has a built-in cost factor. Bcrypt is widely supported but has a maximum password length of 72 bytes. It is not recommended for new systems because it is slower on CPUs than Argon2id and does not support variable memory usage.
Scrypt was designed in 2009 and is memory-hard. It requires a large amount of memory (configurable) and CPU time. Scrypt is resistant to ASIC and GPU attacks because the memory bandwidth becomes the bottleneck. It is used in some cryptocurrency wallets and file encryption tools. However, scrypt is less widely implemented than PBKDF2 and has no NIST standard.
Argon2id is the winner of the 2015 Password Hashing Competition. It is the most modern and recommended KDF for new systems. Argon2id is memory-hard, CPU-hard, and resistant to side-channel attacks. It has three variants: Argon2d (data-dependent), Argon2i (data-independent), and Argon2id (hybrid). OWASP recommends Argon2id for new applications.
PBKDF2 remains the most widely deployed KDF because it is simple, standardized, and available in every major cryptographic library. It is the default in iOS’s CommonCrypto, Android’s KeyStore, and many enterprise systems. For applications that cannot use Argon2id due to platform limitations or compatibility requirements, PBKDF2 with a high iteration count and hardware binding is a strong choice.
How AppVault Uses PBKDF2
AppVault uses PBKDF2-HMAC-SHA256 with 600,000 iterations and a per-install 128-bit salt. The salt is generated during the initial setup and stored in the device’s Secure Enclave. The derived key is then wrapped by a key generated inside the Secure Enclave, which never leaves the chip. This provides hardware-bound protection: even if an attacker extracts the PBKDF2 output, they cannot use it without the Secure Enclave key.
The Pattern Lock on AppVault’s 5×5 grid is converted into a password string. That string is fed into PBKDF2 along with the salt. The resulting derived key is used to encrypt the vault’s catalog and each file individually using AES-256-GCM with a unique 96-bit nonce per file.
AppVault’s zero-knowledge architecture means that the password never leaves the device. The PBKDF2 derivation happens entirely on the iPhone. AppVault’s servers (which do not exist) never see the password or the derived key. The threat model assumes that an attacker may gain physical access to the device, but without the password and the Secure Enclave key, the vault remains sealed.
Other vault apps in this category take different approaches to key derivation. The architectural breakdowns — iteration counts, salt handling, hardware binding versus software-only key custody — live on the dedicated comparison pages: AppVault vs Vaultaire and AppVault vs Keepsafe. AppVault publishes its full cryptography stack with primary-source citations, which is the prerequisite for any independent verification.
Practical Considerations for Developers
If you are implementing PBKDF2, follow these guidelines:
- Use HMAC-SHA256 as the PRF. SHA1 is acceptable but requires more iterations.
- Generate a random salt of at least 16 bytes per user or per instance.
- Set the iteration count to the current OWASP recommendation (600,000 for SHA-256 as of 2026).
- Store the salt and iteration count alongside the derived key (or vault metadata) so that the derivation can be repeated.
- Consider hardware binding (e.g., Secure Enclave, TPM) to protect the derived key even if the device is compromised.
- Do not use PBKDF2 for password storage in authentication systems if Argon2id is available. PBKDF2 is best suited for key derivation in local encryption scenarios.
Conclusion
PBKDF2 is a battle-tested key derivation function that has protected passwords and encryption keys for over two decades. It is not the most modern KDF, but it is the most widely supported and, when configured correctly, provides strong protection against brute-force attacks. The OWASP 2026 recommendation of 600,000 iterations for SHA-256 ensures that each password attempt is expensive enough to deter attackers.
AppVault uses PBKDF2 with 600,000 iterations, a per-install salt, and Secure Enclave wrapping to protect your files. The combination of a high iteration count and hardware binding makes the vault resistant to both software and physical attacks. No password reset, no backdoor, no server-side key recovery. The security of your data depends on the strength of your password and the integrity of the PBKDF2 derivation.
For a deeper look at how AppVault implements its cryptography, see the encryption overview and the threat model.
DIAGRAM · 03
DOSSIER
QUESTIONS
10 sharp answers.
-
01 What is PBKDF2 used for?
PBKDF2 is used to derive a cryptographic key from a password. It is commonly used in disk encryption, password managers, file vaults, and authentication systems. -
02 Why can't you just hash a password directly?
Direct hashing (e.g., SHA-256 of the password) is fast. An attacker can compute billions of hashes per second with a GPU. PBKDF2 slows down the derivation by repeating the hash thousands of times, making brute-force attacks impractical. -
03 How does PBKDF2 work?
PBKDF2 takes a password, a salt, an iteration count, and a desired key length. It applies HMAC (e.g., HMAC-SHA256) repeatedly, feeding the output of each iteration into the next. The final output is the derived key. -
04 What is a salt in PBKDF2?
A salt is a random value, at least 16 bytes, that is combined with the password before hashing. It ensures that the same password produces different keys for different users or instances, defeating rainbow table attacks. -
05 What is the recommended iteration count for PBKDF2 in 2026?
OWASP recommends 600,000 iterations for PBKDF2-HMAC-SHA256. For PBKDF2-HMAC-SHA1, the recommendation is 1,300,000 iterations due to SHA1's smaller output. -
06 Is PBKDF2 better than bcrypt?
Both are key stretching functions, but they differ in design. Bcrypt is more resistant to GPU attacks because it requires a fixed amount of memory. PBKDF2 is more widely supported and can be tuned with higher iteration counts. For new systems, Argon2id is preferred, but PBKDF2 remains a solid choice when hardware acceleration is not available. -
07 How does PBKDF2 compare to Argon2id?
Argon2id is the winner of the Password Hashing Competition and is designed to be memory-hard, making it resistant to GPU and ASIC attacks. PBKDF2 is not memory-hard, so it is more vulnerable to parallel attacks. However, PBKDF2 is simpler, more widely implemented, and sufficient when combined with high iteration counts and hardware binding (e.g., Secure Enclave). -
08 Can PBKDF2 be cracked with GPUs?
Yes, but the iteration count makes it slower. With 600,000 iterations, a single GPU can only attempt a few hundred passwords per second, compared to billions for a single SHA-256 hash. However, dedicated ASICs can still attack PBKDF2 faster than memory-hard functions. -
09 Does AppVault use PBKDF2?
Yes. AppVault uses PBKDF2-HMAC-SHA256 with 600,000 iterations and a per-install 128-bit salt. The derived key is then wrapped by a key generated inside the iPhone Secure Enclave, providing hardware-bound protection. -
10 What happens if I forget my vault password?
AppVault has no password reset. The vault remains sealed. During setup, you can generate an optional written recovery passphrase that can be used to re-derive the key. Without it, the data is unrecoverable.
RELATED DOSSIERS
Keep reading.
6 ENTRIES
- LINK / 01 · Encryption
AES-256-GCM Encryption
How AppVault encrypts each file with a unique nonce and key derived from PBKDF2.
- LINK / 02 · Pattern Lock
Pattern Lock Key Derivation
How the 5×5 pattern is converted into a password for PBKDF2.
- LINK / 03 · Zero Knowledge
Zero-Knowledge Architecture
Why AppVault never sees your password or derived key.
- LINK / 04 · Threat Model
AppVault Security Model
What PBKDF2 protects against and what it does not.
- LINK / 05 · Comparison
AppVault vs Vaultaire
How AppVault's PBKDF2 implementation compares to Vaultaire's.
- LINK / 06 · Comparison
AppVault vs Keepsafe
Why AppVault uses PBKDF2 with Secure Enclave binding while Keepsafe uses a different approach.
GET STARTED
Seal the vault.
Free to download. The first vault is free, forever. Upgrade only when you outgrow it.