Skip to main content
← Unit 5: Securing Applications and Data

Code Scholars Tutoring · AP Cybersecurity

5.3 Cryptography, Hashing, and Data Movement

How it works

Encryption protects readable data by making it unreadable without a key. Hashing supports integrity checks and password storage patterns. TLS protects data in transit.

Use encryption for sensitive data in transit and at rest when appropriate; use hashing when you need to verify without revealing the original value.

Common error

Encoding, compression, hashing, and encryption are not interchangeable.

Worked example

Choose a cryptographic mechanism based on the required property.

Evidence

Goal A: private transfer
Goal B: compare a downloaded file with a trusted digest
Goal C: recover readable stored data with a key
PlaintextEncryption + keyCiphertext
Plaintext → Encryption + key → Ciphertext

Use suitable encrypted transport for A, a cryptographic hash comparison with a trusted expected digest for B, and encryption with controlled key access for C. A matching digest from an untrusted source does not establish authenticity. Hashing is not reversible encryption.

Exercises

5.3.1

Can Base64 encoding protect a secret from a person who receives the encoded text? Explain.

Show solution

No. Base64 is a reversible representation format without a secret key. Confidentiality needs an appropriate encryption and access-control design.

5.3.2

Why is a salted, deliberately slow password-hashing scheme preferable to storing plaintext passwords?

Show solution

It avoids directly exposing readable passwords in the stored record and raises the cost of guessing against a stolen database. It still needs secure authentication, access controls, and operational protection.

Need help with this topic?

Work through questions with a tutor and get help with the steps you find difficult.

Get help with this topic