KDF Hash Generator Online | PBKDF2, Argon2 & Scrypt Key Derivation

Password & Security
100% client-side. Processed locally in your browser using the Web Crypto API. Nothing is sent to any server.
⚠️ Critical Security: Use Argon2id for new projects — it resists both GPU and side-channel attacks. Never use plain SHA hashes for password storage. Always use OWASP 2024 recommended parameters (600K+ iterations for PBKDF2, 64 MiB memory for Argon2id).

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

⚠️ Using Plain SHA-256 for Password Storage — SHA-256 is fast and vulnerable to brute-force attacks. Always use a KDF (Argon2id, PBKDF2, or Scrypt) with high iteration counts for password storage.
⚠️ Low Iteration Counts — PBKDF2 with fewer than 600,000 iterations (OWASP 2024 recommendation) can be brute-forced with modern GPUs. Always use recommended parameters.
⚠️ Salt Reuse — Never reuse salts across passwords. Each password must have a unique 16+ byte salt generated via crypto.getRandomValues().
⚠️ Insufficient Memory for Argon2id — Using less than 64 MiB memory for Argon2id reduces GPU resistance. OWASP recommends 64 MiB minimum for interactive use cases.
⚠️ Client-Side Hashing for Production — This tool is for learning and testing. For production, run KDF computations server-side with well-audited libraries (libsodium, Bouncy Castle) to prevent client-side attacks.

Security Notes

🔒 Argon2id for new projects — winner of the Password Hashing Competition, resists both GPU and side-channel attacks.
🔒 Use OWASP 2024 parameters as baseline — click the preset button to auto-fill recommended iterations/memory/parallelism.
🔒 Salt must be unique per password — never reuse salts; 16 bytes (128 bits) minimum, generated via crypto.getRandomValues.
🔒 Production: run server-side — this tool is for learning and testing; use libsodium or Bouncy Castle in production.

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

Related Concepts

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

Learn More