A PBKDF2 hash generator tool turns your password and a random salt into a fixed-length derived key by running a hash function thousands of times. Use this guide to understand every field, pick secure parameters and generate the output with confidence before it reaches a database. PBKDF2 is slow on purpose, and that slowness is what protects every password you store.
How a Password-Based Key Derivation Function Works
PBKDF2 stands for password-based key derivation function 2. It applies an HMAC to your password and salt, then feeds each round into the next, so an attacker must repeat all of that work for every single guess. That repeated work is why it remains secure hashing for passwords, and why a good generator exposes four parameters: password, salt, iterations and key length. In cryptography terms the whole process is one formula: A quick way to check test vectors from the Password Hashing Competition winner is the argon2 hash generator, which runs reference code in WebAssembly.
$$DK = \text{PBKDF2}(\text{PRF}, P, S, c, dkLen)$$
Here \(P\) is the password, \(S\) the salt, \(c\) the iteration count and \(dkLen\) the length of the derived key.
Salt and Password Inputs
Type your plain-text password, then supply a random salt of at least 16 bytes. A cryptographic salt makes identical passwords produce different hashes, which defeats rainbow tables and other precomputed tables. Store the salt beside the result, in hex or Base64, because the verifier needs it again. A pepper, a secret kept outside the database, adds another layer, while the salt itself is never secret.
Iteration Count and Key Length Trade-Offs
The iteration count sets how many times the HMAC repeats, so doubling it doubles the processing time for you and for an attacker. Benchmark on your own server and choose the highest iterations your login latency can tolerate, then raise them as hardware improves. The key length, also called key size, is measured in bits: 256 bits matches SHA-256 output, while asking for more only slows you down. Strong iterations are the main defence against brute-force attacks, since they cap how many guesses per second an attacker can test.
Picking SHA-256 or SHA-512 for PBKDF2 Password Hashing
The hash algorithm is the first decision. SHA-256 is the common default, and SHA-512 offers comparable strength at a lower recommended iteration count. A weaker SHA-1 still works inside HMAC, yet a new hashing algorithm choice should not start there. Pick the output format your application expects: hexadecimal is easy to read, and Base64 is shorter. The same method derives encryption keys from a passphrase, though you should never reuse one derived key for two purposes. PBKDF2 password hashing is only as strong as these choices, and any password hash generator should let you change each one. For testing check_password or make_password output, the django password hash generator shows each part of a hash version, salt length and work factor.
Verify a PBKDF2 Hash Generator Result and Read the Security Summary
To verify a stored password hash, the tool parses the algorithm, salt, iterations and key length from the string, recomputes the result from the candidate password and compares the two. A constant-time comparison blocks timing attacks, which measure how quickly a mismatch is rejected. The security summary then flags weak parameters, such as a short salt or low iteration count, and any authentication system benefits from the same check. If a framework rejects your hash, compare its parameter selection with the values shown in the generator's output first, since attackers only benefit when weak parameters slip through unnoticed.
Is it safe to paste a real password into an online page? Generate demo values with throwaway passwords. A client-side page keeps data in your browser, while a server-side page sends it over the network, and a secure workflow derives production hashes inside your own backend, where the salt and any pepper stay under your control.
Worked Example: PBKDF2 Tool Run With Real Parameters
Take the password maple-Harbor-47 and the 16-byte salt a3f19c2e7b4d8056e1c9027fb3d4a681. Running the tool with a 32-byte key length gives these results, computed with Python's standard library:
| Setting | HMAC-SHA-256 | HMAC-SHA-512 |
|---|---|---|
| Iterations | 600,000 | 210,000 |
| Derived key (hex) | 7da877fa…93a1ee | 98a9a356…5d2c |
| Compute time | 0.134 seconds | 0.079 seconds |
Full SHA-256 output: 7da877fafe62758d4f9d18e1aeba527c33a95e5464dbbc399d20726d0093a1ee. Drop to 1,000 iterations and the derived key becomes 5dad7c0f…12e014, produced almost instantly, which is exactly how fast an attacker could test guesses. Doubling the SHA-256 run to 1,200,000 iterations would roughly double that 0.134 seconds, and the same doubling applies to every guess an attacker makes.
Upgrading Legacy Logins With a PBKDF2 Tool Benchmark
Last month I inherited a small internal app whose user table still stored passwords hashed with only 10,000 iterations of HMAC-SHA-256. The question I had to answer was simple: how many iterations can the login server afford without making sign-in feel slow? I ran the generator on my own hardware because I wanted the answer from my machine, not a blog post.
I entered the throwaway password Lantern-Quay-8362! and the 16-byte salt 5e0c71d94ab2f3861d07c8e49b25a3f0, kept SHA-256 and a 32-byte key length, and ran three iteration counts in order. The timings came from a short Python loop, best of three runs:
| Iterations | Key length | Time per hash |
|---|---|---|
| 10,000 | 32 bytes | 3.2 ms |
| 600,000 | 32 bytes | 122.1 ms |
| 1,200,000 | 32 bytes | 244.8 ms |
The 600,000 run took 122.1 ms, which clears the NIST SP 800-63B minimum for PBKDF2-HMAC-SHA256 and sits comfortably under the 250 ms login budget I had in mind. The old setting was 60 times cheaper for an attacker to guess against. I cross-checked the first run by hand: the 600,000 result begins 4b3df02e and ends 9360e5cf, and the verify step reproduced it exactly.
The number to watch is the key length, because it changes the result in a way the iteration field hides. Asking for 64 bytes at 600,000 iterations took 244.4 ms, double the cost, because SHA-256 only produces 32 bytes per block. Its first 32 bytes were identical to the shorter key, so an attacker needs only the first block while my server pays for both. Request exactly the hash length, or switch to SHA-512 if you truly need 64 bytes.
My decision: raise the cost to 600,000, store the iteration count beside every hash, and rehash each account the next time its owner signs in. Whenever the server hardware changes, I repeat the benchmark rather than trust an old number.
PBKDF2 Generator vs Argon2, bcrypt and scrypt
PBKDF2 is CPU-hard only, so GPUs speed up an attacker's guessing far more than yours. The alternatives close that gap:
- bcrypt has a built-in salt and an adaptive cost factor.
- scrypt is memory-hard, which limits parallel guessing.
- Argon2id is memory-hard and tunable, giving the best GPU resistance of the group.
Keep PBKDF2 where legacy systems, FIPS compliance or broad compatibility matter, and move to Argon2id or bcrypt when you control the stack.
Why Argon2 Is the Modern Default
The OWASP-preferred variant, Argon2id, demands memory as well as time. That memory cost is what GPU resistance means in practice, and it is why Argon2id is recommended for new password storage. Pick PBKDF2 only when your platform rules Argon2id out.
Hashing Algorithm Standards: OWASP, NIST and RFC 8018
NIST SP 800-63B guidance asks for at least 600,000 iterations with HMAC-SHA-256, or 210,000 with SHA-512. The function is specified in RFC 8018, which replaced RFC 2898 and the PKCS #5 standard it came from. Developers who need FIPS approval usually choose PBKDF2 for exactly that reason. Revisit the iteration figures every year, because attacker hardware improves, and record the parameters next to each stored hash so older entries can be upgraded when users next log in.
PBKDF2 Code in PHP, Java and JavaScript
In PHP, call hash_pbkdf2 with the algorithm, password, salt, iterations and length. PHP counts length in hex characters unless you request binary output, so pass 64 for a 32-byte key. PHP 8 throws a ValueError for zero iterations, and the PHP manual itself points to password_hash as better suited to password storage. Java uses PBEKeySpec with SecretKeyFactory, JavaScript uses the Web Crypto API for client-side work, and OpenSSL covers the command line. Compare your own code's output with the generator's result to confirm both agree.
Frequently Asked Questions
- What is PBKDF2 and why does it need a salt and iteration count?
- PBKDF2 (Password-Based Key Derivation Function 2, RFC 8018) deliberately slows down key derivation by repeating the underlying HMAC computation many times (the iteration count) -- this makes brute-force attacks against a stolen hash dramatically more expensive. The salt (a random value stored alongside the hash) ensures two users with the same password get completely different derived keys, defeating precomputed rainbow-table attacks.
- How many iterations should I use?
- OWASP's current recommendation for PBKDF2-HMAC-SHA256 is at least 600,000 iterations (this tool's default) as of their 2023+ guidance -- higher is more secure but slower for legitimate use too, so the right number balances your threat model against acceptable login latency.
- Should I keep the salt secret?
- No -- the salt is meant to be stored alongside the derived key/hash, not kept secret. Its job is to make every derivation unique, not to add secrecy; PBKDF2's actual security comes from the password's own entropy and the iteration count.
- What's the difference between the hex and Base64 output?
- They're the exact same derived key bytes, just encoded differently -- hex is more human-readable for debugging, while Base64 is more compact and is what many systems (including Django's password hasher) actually store in their password field format.
- Is my password sent anywhere?
- No. The entire derivation runs locally using the Web Crypto API -- your password, salt, and derived key are never transmitted to a server or stored.