KDF Hash Generator Online | PBKDF2, Argon2 & Scrypt Key Derivation
Password & Security How It Works
What Is a KDF Hash Generator?
A Key Derivation Function (KDF) transforms a password into a cryptographic key suitable for encryption or password storage. Unlike fast hash functions (SHA-256, MD5), KDFs are deliberately slow and memory-intensive to resist brute-force attacks. This tool implements three modern KDFs — PBKDF2, Argon2id, and Scrypt — using the audited @noble/hashes library.
Each algorithm serves different security and compatibility needs; Argon2id is recommended for new projects. All computation runs entirely in your browser, making it safe for learning and testing reference values.
When to Use a KDF
- Password storage — Hash user passwords before storing in databases (Argon2id recommended)
- Key derivation — Derive encryption keys from passwords (e.g., for AES-256)
- Token generation — Create secure tokens from user-provided secrets
- Migration from legacy systems — Upgrade from MD5/SHA to modern KDFs
- Testing and validation — Generate reference values for cross-platform compatibility
- When NOT to use — Don't use KDFs for checksums or data integrity (use SHA-256 instead)
KDF Algorithm Selection
| Feature | PBKDF2 | Argon2id | Scrypt |
|---|---|---|---|
| Standard | RFC 2898 | RFC 9106 | RFC 7914 |
| GPU resistance | Low | High | Medium |
| Memory-hard | No | Yes | Yes |
| Side-channel resistant | Partial | Yes (Argon2i mode) | Partial |
| Best for | Legacy compatibility | New projects (recommended) | When Argon2 unavailable |
Standards Compliance
- PBKDF2 — RFC 2898 (2000), NIST SP 800-132 compliant
- Argon2id — RFC 9106 (2021), Password Hashing Competition winner (2015)
- Scrypt — RFC 7914 (2016)
- OWASP Password Storage Cheat Sheet — 2024 recommended parameters
- PHC String Format — Password Hashing Competition standard output format
Last updated:
Code Examples
Derive keys programmatically using well-audited libraries:
JavaScript — @noble/hashes (PBKDF2)
import { pbkdf2 } from '@noble/hashes/pbkdf2';
import { sha256 } from '@noble/hashes/sha256';
const password = 'my_secure_password';
const salt = new Uint8Array(16); // Generate with crypto.getRandomValues()
crypto.getRandomValues(salt);
const key = pbkdf2(sha256, password, salt, { c: 600000, dkLen: 32 });
console.log('Derived key (hex):', Buffer.from(key).toString('hex')); Python — libsodium (Argon2id)
import nacl.pwhash
password = b'my_secure_password'
# Generate hash with OWASP recommended parameters
hashed = nacl.pwhash.str(
password,
opslimit=nacl.pwhash.argon2id.OPSLIMIT_INTERACTIVE, # 3 iterations
memlimit=nacl.pwhash.argon2id.MEMLIMIT_INTERACTIVE # 64 MiB
)
print('PHC string:', hashed.decode('utf-8'))
# Verify
if nacl.pwhash.verify(hashed, password):
print('Password verified!') Go — golang.org/x/crypto (PBKDF2)
package main
import (
"crypto/rand"
"crypto/sha256"
"encoding/hex"
"fmt"
"golang.org/x/crypto/pbkdf2"
)
func main() {
password := []byte("my_secure_password")
salt := make([]byte, 16)
rand.Read(salt)
// OWASP recommended: 600,000 iterations for PBKDF2-HMAC-SHA256
key := pbkdf2.Key(password, salt, 600000, 32, sha256.New)
fmt.Println("Derived key:", hex.EncodeToString(key))
} Rust — argon2 crate
use argon2::{
password_hash::{rand_core::OsRng, PasswordHash, PasswordHasher, PasswordVerifier, SaltString},
Argon2,
};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let password = b"my_secure_password";
// Generate salt
let salt = SaltString::generate(&mut OsRng);
// Hash with Argon2id (OWASP recommended parameters)
let argon2 = Argon2::default();
let password_hash = argon2.hash_password(password, &salt)?.to_string();
println!("PHC string: {}", password_hash);
// Verify
let parsed_hash = PasswordHash::new(&password_hash)?;
assert!(argon2.verify_password(password, &parsed_hash).is_ok());
Ok(())
} Node.js — scrypt
const crypto = require('crypto');
const password = 'my_secure_password';
const salt = crypto.randomBytes(16);
// Scrypt with OWASP recommended parameters (N=2^14, r=8, p=1)
const key = crypto.scryptSync(password, salt, 32, {
N: 16384,
r: 8,
p: 1,
});
console.log('Derived key (hex):', key.toString('hex')); Common Pitfalls & Attack Vectors
Security Notes
Disclaimer
Disclaimer: This page is for educational and testing purposes only. It does not constitute professional security advice. For production password storage and key derivation, consult official standards (NIST, OWASP, RFC 9106) and conduct a formal security review.
Further Reading & Standards
- RFC 9106 — Argon2: Memory-Hard Function for Password Hashing
- RFC 2898 — PKCS #5: Password-Based Cryptography Specification
- RFC 7914 — The scrypt Password-Based Key Derivation Function
- OWASP Password Storage Cheat Sheet — Secure Password Storage Guidelines
- NIST SP 800-132 — Recommendation for Password-Based Key Derivation
Related Concepts
- Key Management — How to securely generate, store, and rotate cryptographic keys
- Symmetric vs Asymmetric Encryption — Understanding cryptographic fundamentals
- SHA Hash Generation — Fast hashing for data integrity (not for passwords)
- Post-Quantum Cryptography — How quantum computers will affect password hashing
Related Tools
Need to verify the strength of your derived key? The Password Strength Checker scores it on a 0-4 scale. For raw SHA hashing without key derivation, try the SHA Hash Generator. To generate the initial password, the Password Generator creates cryptographically secure random strings.
Frequently Asked Questions
What are the OWASP 2024 recommended parameters?
PBKDF2-HMAC-SHA256: ≥ 600,000 iterations. Argon2id: 64 MiB memory, 3 iterations, 4 parallel lanes. Scrypt: N=2^14 (16384), r=8, p=1. Click "Apply OWASP Recommended Parameters" to auto-fill these values.
What is PHC string format?
PHC (Password Hashing Competition) string format embeds the algorithm identifier, parameters, salt, and derived key in a single portable string — e.g., $argon2id$v=19$m=65536,t=3,p=4$<salt>$<hash>. This format is self-describing and compatible with modern password hashing libraries.
How is the salt generated?
Click the "Random" button next to the salt field to generate a cryptographically secure random salt using the Web Crypto API (crypto.getRandomValues). A minimum of 16 bytes (128 bits) is recommended. The salt must be unique per password and stored alongside the derived key.
Is this tool safe for production password hashing?
This tool is designed for learning, testing, and generating reference values. For production use, run KDF computations server-side with a well-audited library (e.g., libsodium, Bouncy Castle). Never transmit raw passwords over the network.
What output formats are supported?
Three formats: Hex (raw bytes as hex string), Base64 (standard Base64 encoding), and PHC string format (embeds algorithm, parameters, salt, and hash in one portable string). PHC format is recommended for password storage as it is self-describing.
Privacy: This tool runs entirely in your browser — nothing is uploaded or stored. · Disclaimer: For educational purposes only. Not professional security advice.
More in Password
Password Generator
Generate secure random passwords online with customizable length, character types, symbols, and exclusion rules. Quick presets available.
Password Strength Checker
Check password strength and estimate crack time online. zxcvbn-based entropy analysis, multiple attack scenarios, and pattern recognition.
Passphrase Generator
Generate strong passphrases from random dictionary words online. EFF wordlist, configurable separators, and color-coded strength.
Entropy Calculator
Calculate password and passphrase entropy online. Crack time estimates, character pool analysis, and strength ratings.
Shamir Secret Sharing
Split secrets into shares using Shamir's Secret Sharing over GF(256). Any K-of-N threshold reconstruction with Lagrange interpolation.