Security · Hashing
Hash Function
Cheat sheet · https://pcornel.dk/topic.php?topic=4707
Answer
A hash function maps any input to a fixed-size digest. A cryptographic one is one-way, collision-resistant and changes completely when the input changes by one bit.
Remember
- A hash is one-way and fixed length.
- A tiny input change gives a different hash.
- Hashing is not encryption.
First checks
sha256sum file— digest- Properties: preimage, second-preimage, collision resistance — security goals
- Algorithm choice — SHA-2/3, BLAKE2/3
Verify in this order
input → hash → digest
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=4707