Password hashing: bcrypt, scrypt, Argon2
A stolen database must not reveal passwords. The defence is a hash designed to be slow, with a unique per-user salt.
Why not SHA-256
SHA and MD5 are fast: a GPU tries billions of hashes per second, and a dictionary falls in minutes. You need functions deliberately expensive in time and memory.
// PHP: picks and upgrades the algorithm itself
$hash = password_hash($pw, PASSWORD_ARGON2ID);
if (password_verify($pw, $hash)) { /* ok */ }Which one
Argon2id is the modern choice: memory cost hinders GPUs/ASICs. scrypt similar. bcrypt still acceptable (mind the 72-byte limit). The salt is handled for you; a separate pepper is not required if parameters are adequate. Raise the cost over time.