Hashing
Cheat sheet · https://pcornel.dk/topic.php?topic=4706
Answer
Hashing turns data of any size into a fixed-length digest with a one-way function. It is used for integrity checks, digital signatures and, with slow salted algorithms, for storing passwords.
Remember
- MD5 and SHA-1 are broken for security use.
- Passwords need slow, salted hashes, not plain SHA-256.
- Hashes prove integrity only if the hash itself is trusted.
First checks
sha256sum <file>— computesha256sum -c SHA256SUMS— verify listGet-FileHash <file> -Algorithm SHA256— Windows
Verify in this order
data → hash → compare with trusted value
Where it usually breaks
First mismatch in key/secret generation → storage/rotation → trust/certificate validation → protocol negotiation → cryptographic operation → peer/application verification; preserve identity/policy/pre-state before mutation.
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=4706