Hashing vs encryption, and how to tell them apart
Hashing is a one-way function. It turns any input into a fixed-length digest that can't be turned back into the original, so you use it to check integrity. Encryption is two-way. It scrambles data so that someone with the right key can recover it, so you use it to protect confidentiality. If you need the data back, encrypt it. If you only need to prove it hasn't changed, hash it.
From the lesson Hashing algorithms
Why it matters on the exam
In the V8 objectives, hashing algorithms, salting and encryption are listed together under 1.3 on cryptographic solutions, and hashing and encryption appear again under 3.3 as methods used to secure data. Exam questions like to blend the two and test whether you know which one protects confidentiality and which one proves integrity. Some go a step further and ask about the integrity of a file versus its authenticity.
Key points
- One-way by design. A hash can't be reversed. It should be computationally infeasible to find an input that produces a given digest, so you never decrypt a hash.
- Fixed-length output. Whether you hash one word or a huge file, the digest from a given algorithm such as SHA-256 is always the same length. The same input always gives the same digest.
- A file fingerprint. A hash works like a fingerprint of a file. To verify integrity, hash the file you have and compare it with the trusted value. Any change to the file gives a different digest.
- Collisions weaken it. A collision is when two different inputs produce the same digest. If collisions can be found, an attacker could swap in a different file with a matching hash, so the algorithm can no longer be trusted for integrity.
- Know the common names. SHA-256 belongs to the SHA-2 family that NIST approves. MD5 is another hashing algorithm you should recognize by name. Both are hashes, not encryption.
| Feature | Hashing | Encryption |
|---|---|---|
| Direction | One-way, can't be reversed | Two-way, reversed with a key |
| Output | Fixed-length digest | Ciphertext you can decrypt |
| Key needed | No key for a plain hash | Yes, a key to encrypt and decrypt |
| Main goal | Integrity | Confidentiality |
| Typical use | Verifying downloads, storing passwords with a salt | Protecting data at rest or in transit |
Common trap
Thinking a matching hash proves who sent the file. A hash alone proves integrity, meaning the file didn't change. It doesn't prove authenticity. For that you need an HMAC, a digital signature, or a hash value you got from a trusted source.
Question 1 of 5
A systems administrator downloads an installer from a vendor's website. The vendor lists a SHA-256 value for the file next to the download link. What should the administrator do to confirm the file was not altered in transit?

Tap an answer and I’ll tell you why.
Question 1 is written for this page and checked by a person. The others are practice questions from the MindMax app. None are from a past exam.
Where it comes from
Lesson 4 in Cryptography Fundamentals · 1.0 General Security Concepts
Hashing algorithms
- Explain that hashing is one-way and produces a fixed-length digest
- Distinguish hashing from encryption
- Identify common hashing algorithms such as SHA-256 and MD5
- Define a collision and why it weakens an algorithm
- Use hash comparison to verify file integrity
Key terms in this lesson
- SHA-256
- A one-way hashing algorithm in the SHA-2 family that produces a fixed-length 256-bit digest. Comparing a file's digest with the publisher's value verifies its integrity.
Learn more
FAQ
No. A cryptographic hash is a one-way function, so there is no key and no process that turns a digest back into the original data. That's the main thing that separates it from encryption, which is built to be reversed by someone holding the right key.
Get the publisher's hash value from a source you trust, then compute the hash of your copy using the same algorithm, such as SHA-256. If the two digests match exactly, the file hasn't changed. If even one character differs, the file was altered or corrupted.
A collision happens when two different inputs produce the same digest. A good hash is collision resistant, meaning collisions should be practically impossible to find. If an attacker can create one, they could pass off a tampered file as the real one, which is why collisions weaken an algorithm.