What this miniature lab demonstrates
Create two harmless byte strings and show that the same filename tells us nothing about byte-level integrity.
Set up a harmless offline test
Requires Python 3. Run only on your own computer in a text console. No packages, accounts, network connections, malware, production logs or cloud credentials are required. Copy the example into a file or download the runnable script. The script includes assertions that fail if the expected behaviour changes.
from hashlib import sha256
original = b"Sample offline policy: allow only approved software\n"
changed = b"Sample offline policy: allow all software\n"
expected = sha256(original).hexdigest()
def verify(data, trusted_digest):
return sha256(data).hexdigest() == trusted_digest
assert verify(original, expected)
assert not verify(changed, expected)
print("Original matches trusted digest:", verify(original, expected))
print("Changed matches trusted digest:", verify(changed, expected))
print("Trusted hash prefix:", expected[:16])
Output from the bundled script
The following text was generated by running this exact script in an offline Python environment during package validation. It is not a product or attacker simulation result.
Original matches trusted digest: True
Changed matches trusted digest: False
Trusted hash prefix: 1f76f0bb8df704fc
Interpretation and limits
The SHA-256 digests are calculated from synthetic content in memory. A matching hash helps establish integrity relative to a separately trusted digest, not whether a program is safe to execute.
Questions to discuss
How would you obtain a genuine independently trusted digest before examining a real downloaded installer?
To practise further, open the endpoint labs learning track and download a three-case CSV from any individual guide. Those records are fictional and deliberately contain an ambiguous case for analysis.
Primary sources
Scope: An illustrative educational model tested for deterministic output; no real-world security effectiveness or deployed vulnerability assessment is claimed. If a command, API or framework changes, follow the current official documentation and obtain approval before changes to real systems.