Drill 27 ยท
AP Cybersecurity Drill 27: Checking File Integrity with Hashes is a practice drill. It contains 5 original questions created by Brian Stewart, a Barron's test prep author with over 20 years of tutoring experience.
Pallisk Geomatics records a SHA-256 hash of each survey file before transfer and recomputes the hashes after the files arrive; this drill uses an invented company and original figures.
Pallisk Geomatics -- file integrity check after transfer
Each survey file is hashed with SHA-256 at the sending site. After the files arrive, the receiving site recomputes each hash and compares it to the value sent ahead. The receiving site compared the full SHA-256 digests; the table shows the first 16 characters of each digest for readability.
| File | Hash before transfer | Hash after transfer |
|---|---|---|
| parcel_north.csv | 9f1c4a77b203de58 | 9f1c4a77b203de58 |
| parcel_south.csv | 2b8e0d4416ca7f91 | 2b8e0d4416ca7f91 |
| elevation_grid.csv | d57a9c01e6b3428f | a04f7e92c1d8b365 |
| boundary_notes.csv | 6c3f81aa5d09e7b4 | 6c3f81aa5d09e7b4 |
SHA-256 always produces a fixed-length digest, and even a one-byte change to a file produces a very different digest.
Question 1. Reading the table, which file's hash does not match between before and after transfer?
Explanation: Choice C is correct. The elevation_grid.csv row shows a before digest that differs from its after digest, while every other row matches; a changed digest is the only evidence that matters here. Choice A is incorrect because identical before and after digests mean parcel_north.csv is unchanged. Choice B is incorrect because boundary_notes.csv matches before and after, and a guess about which file is likely edited is not evidence. Choice D is incorrect because a file's position in the list says nothing about whether its hash changed.
Question 2. What does comparing these before-and-after hashes let the receiving site verify?
Explanation: Choice B is correct. A hash comparison checks integrity: a matching digest shows the file's contents are unchanged since it was hashed. Choice A is incorrect because hashing does not hide contents; confidentiality comes from encryption. Choice C is incorrect because a plain hash does not establish who sent the file; that is authenticity, which needs a signature or keyed hash. Choice D is incorrect because hashing is unrelated to compression and does not shrink a file.
Question 3. A colleague says the recorded hash can simply be reversed to rebuild the original file. Why is that claim about a cryptographic hash incorrect?
Explanation: Choice D is correct. A cryptographic hash reduces input of any size to a fixed-length digest, and recovering the original input from that digest is not computationally feasible. Choice A is incorrect because a hash is not encrypted and uses no key, so decryption does not apply. Choice B is incorrect because the digest is fixed-length and usually far shorter than the file, not longer. Choice C is incorrect because the digest is computed from the file's contents, not merely its name and size.
Question 4. Because the elevation_grid.csv digests differ, what has the integrity check detected about that file?
Explanation: Choice C is correct. A mismatch shows only that the bytes differ between the two hashing points; the file changed somewhere in between, whether by corruption or tampering. Choice A is incorrect because the hash alone cannot tell deliberate tampering from accidental corruption, and corruption does change the hash. Choice B is incorrect because a hash mismatch does not reveal whether anyone read the file; that is confidentiality, not integrity. Choice D is incorrect because nothing in a digest indicates the recipient or routing of the file.
Question 5. What is the best next step for the elevation_grid.csv file given the mismatch?
Explanation: Choice A is correct. Because the integrity check failed, the safe response is to obtain a fresh copy and confirm its hash matches before relying on the data. Choice B is incorrect because using a file known to differ risks acting on corrupted or tampered data. Choice C is incorrect because the other three files matched, so discarding the whole batch is unnecessary. Choice D is incorrect because assuming a display error and keeping the file ignores the evidence that its contents actually differ.