# What is a key derivation function?

> An algorithm that turns a low-entropy secret such as a password into a fixed-length cryptographic key, deliberately slowly.

Last reviewed: 2026-09-01

## Key derivation function

Category: Cryptography

Also called: KDF

Canonical page: https://moolkey.com/glossary/key-derivation-function

A key derivation function turns a human-chosen password into a fixed-length cryptographic key. Because passwords are short and predictable while keys must be neither, a KDF stretches the input through thousands of expensive operations, making each attacker guess costly. PBKDF2, bcrypt, scrypt, and Argon2 are the common choices.

### Why not just hash the password once

A single SHA-256 pass takes microseconds, which means an attacker with a GPU can test tens of billions of candidate passwords per second. A KDF deliberately makes that one operation take a meaningful fraction of a second, collapsing the attacker's throughput by five or six orders of magnitude.

### The three hardness properties

Compute-hard functions cost CPU time (PBKDF2). Memory-hard functions additionally demand large amounts of RAM per guess, which defeats the cheap parallelism of GPUs and custom silicon (scrypt, Argon2). Argon2id combines both and is the current recommendation where it is available.

### Sources

- [OWASP: Password Storage Cheat Sheet](https://cheatsheetseries.owasp.org/cheatsheets/Password_Storage_Cheat_Sheet.html): Practical guidance for salts, peppers, PBKDF2, Argon2id, and password hashes.
- [NIST: Computer Security Resource Center glossary](https://csrc.nist.gov/glossary): Canonical terminology used across US computer security guidance.
