What is a hash?
A hash function creates a fixed-length fingerprint for data. It is useful for integrity checks and verification, but a hash is not encryption.
MD5, SHA-1, SHA-256 and SHA-512
MD5 and SHA-1 are legacy algorithms and should not be used for cryptographic protection. SHA-256 and SHA-512 remain useful for integrity checks, depending on the use case.
Hashing vs encryption vs encoding
- Encoding: reversible data representation.
- Encryption: reversible with the correct key.
- Hashing: one-way fingerprinting for integrity and verification.
For password storage, use a purpose-built password hashing algorithm such as Argon2, bcrypt, scrypt or PBKDF2—not MD5, SHA-1, or a direct SHA-256/SHA-512 hash.