A hash function turns any input – a word, a document, a 4 GB file – into a short fixed-length fingerprint. Change a single character and the fingerprint changes completely. Hashes are used to verify downloads, detect changes, sign API requests and store passwords safely (with the right algorithm).
Page Contents
Properties of a good hash
- Deterministic: the same input always gives the same hash.
- Fixed length: SHA-256 always produces 64 hexadecimal characters.
- One-way: you cannot turn the hash back into the input.
- Avalanche effect: a tiny change gives a completely different hash.
- Collision-resistant: it should be practically impossible to find two inputs with the same hash.
The common algorithms
| Algorithm | Output length | Status |
|---|---|---|
| MD5 | 128 bits (32 hex characters) | Broken for security – collisions are easy. OK for non-security checks |
| SHA-1 | 160 bits (40 hex) | Broken for security – practical collisions shown in 2017 |
| SHA-256 | 256 bits (64 hex) | Secure – the standard choice |
| SHA-384 | 384 bits (96 hex) | Secure |
| SHA-512 | 512 bits (128 hex) | Secure, often fast on 64-bit CPUs |
Rule of thumb: use SHA-256 unless a system requires something else.
Verify a downloaded file
Many software sites publish a SHA-256 checksum next to the download.
- Open the Hash Generator and choose File.
- Select the downloaded file and SHA-256.
- Paste the published checksum into the compare field.
- A match means the file is complete and unchanged.
What is HMAC?
An HMAC is a hash combined with a secret key. Only someone with the key can produce the right value, so it proves a message came from a trusted sender and was not changed. Webhooks from payment providers and many APIs sign requests with HMAC-SHA256.
Passwords: never use a plain hash
MD5, SHA-1 and even SHA-256 are designed to be fast – which lets attackers try billions of guesses per second against a leaked database. Store passwords with a slow, salted password-hashing algorithm instead: Argon2id, bcrypt or scrypt (or PBKDF2 where required). Your framework’s built-in password functions usually do this correctly. For users, see how to create a strong password.
Hashing vs encoding vs encryption
| Reversible? | Needs a key? | Purpose | |
|---|---|---|---|
| Encoding (Base64, URL encoding) | Yes, by anyone | No | Represent data safely |
| Hashing | No | No (HMAC: yes) | Fingerprint and verify |
| Encryption | Yes, with the key | Yes | Keep data secret |
Learn more in what is Base64 and what is URL encoding.
FAQ
Is MD5 still safe?
Not for security. It is fine for detecting accidental changes, such as cache keys or duplicate detection.
What is the difference between SHA-256 and SHA-512?
Output length and internal design. Both are secure; SHA-256 is more widely used.
Can a hash be decrypted?
No. Hashing is one-way. “Hash crackers” only guess common inputs and compare results.
Why do two different files have the same MD5?
MD5 collisions can be created deliberately. Use SHA-256 for security.
Are my files uploaded?
No. Hashes are calculated in your browser.
Need a website or app for your business? Talk to Techpass Master – we design and build websites and apps for clients worldwide.
