Per NIST (National Institute of Standards and Technology):
Use a hash function, iterate over an HMAC with a random salt for about a 100ms duration and save the salt with the hash. Use functions such as PBKDF2
, password_hash
, Bcrypt
and similar functions. The point is to make the attacker spend a lot of time finding passwords by brute force.
See: How to store your users’ passwords safely
Excerpted from the presentation "Toward Better Password Requirements" by Jim Fenton
Information based on NIST SP 800-63-3 Draft document "Digital Authentication Guidelines"
Do:
Require an 8 character min, >64 max with no truncation or 6 random digits
Use a dictionary to disallow common passwords against a dictionary list of 10M compromised passwords
Allow all printing characters (Unicode optional) + spaces but MAY canonicalize spaces out
Best to accept Unicode, including emojis (1 “character”/code point)
Limit failed authentication attempts to 100 in 30-day period per account
Offer option to display the secret while typing rather than dots or asterisks
Storing passwords:
Hash with 32-bit random salt using key derivation function such as
PBKDF2 with SHA-1, SHA-2 family, SHA-3 family
with at least 10,000 iterations
Don't:
Require composition rules
Allow hints
Require routine password expiration
Save plain or hashed versions with or without seeding
See: Toward Better Password Requirements by Jim Fenton.