PBKDF2 (Password-Based Key Derivation Function 2) is a key derivation function that applies a pseudorandom function (like HMAC) to a password along with a salt, repeated many times to produce a derived key. While widely supported, it's less resistant to GPU attacks than newer alternatives.
DK = PBKDF2(PRF, Password, Salt, c, dkLen)
PRF: Pseudorandom function (usually HMAC-SHA256)
Password: User's password
Salt: Random value
c: Iteration count
dkLen: Desired key length
# Python
import hashlib
import os
password = b"secretpassword"
salt = os.urandom(16)
iterations = 600000
# Derive key
derived_key = hashlib.pbkdf2_hmac(
'sha256',
password,
salt,
iterations,
dklen=32
)