What a hash is
A cryptographic hash function turns any input — a word, a paragraph, a whole file — into a fixed-length string of hexadecimal digits called a digest. The same input always produces the same digest, but the process is one-way: you can't reverse a digest back to the original text.
Good hash functions are deterministic, fast, and collision-resistant — it's effectively impossible to find two different inputs with the same hash, and changing a single character produces a completely different digest. That makes hashes ideal for verifying that data hasn't changed.
Worked example
The SHA-256 digest of the text Calcool:
Choosing an algorithm
SHA-256 is the modern default and a good choice for checksums and integrity checks. SHA-384 and SHA-512 produce longer digests for higher security margins. SHA-1 is included for compatibility with older systems but is considered broken for security purposes and should not be used where collision resistance matters. None of these are password hashes — for storing passwords, a dedicated slow algorithm like bcrypt or Argon2 is required.