Metadata hashes and indicators
Use hashes for content comparison
SHA-256 maps bytes to a 256-bit digest, commonly represented by 64 hexadecimal characters. It is useful for tracking exact artifacts and comparing them with trusted reference digests. A matching digest strongly supports a content match, not a malware verdict. For the supplied inert files only, Python’s hashlib.sha256(data).hexdigest() returns the lowercase hexadecimal digest.
A repeatable example
The file note.txt contains exactly the ASCII bytes abc, without a newline. Its SHA-256 starts with ba7816bf. copy.txt has the same bytes; changed.txt contains abd. Compute full digests using the code below. Compare all 64 characters, not just the prefix. A changed digest does not tell you what changed or whether the change is malicious.
from pathlib import Pathfrom hashlib import sha256for name in ("note.txt", "copy.txt", "changed.txt"): data = Path(name).read_bytes() print(name, len(data), sha256(data).hexdigest())Run only from the provided fixtures directory. The first two results match; the third differs.
Indicators require context
An indicator of compromise (IoC) is a clue linked to possible compromise. A digest, domain, address or behavior may be recorded with source, confidence, scope, first observation and expiry. In indicators.json, I1 is an active fictional hash associated with a classroom review; I2 has expired. Even an active exact match calls for contextual review, not automatic deletion. Shared infrastructure and outdated information can generate false associations.
Missing and malformed values
An absent digest is unknown, not a mismatch. A short digest or nonhexadecimal value is invalid. File size, format and name can support investigation but cannot replace a full digest. A clean reputation result cannot prove safety; a single suspicious string is not proof of malicious behavior. Do not send hashes or files to external services without approved data-handling rules.
Practice: dated indicator matching
At the fixed classroom time 2026-11-01T12:00:00Z, compare the digests of the three supplied files with indicators.json. A match is reviewable only when the digest is valid, scope is classroom and observed time is before expiry. Equality with expiry is expired. Report inactive, invalid and unrelated records separately. Explain why an active match never triggers containment on its own.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Metadata hashes and indicators — knowledge check
Evaluate malware classifications, inert reports, indicators and response decisions.
What is the SHA-256 hexadecimal length?
Two complete matching SHA-256 digests support what?
How should a missing digest be handled?
At exact expiry, how does this lab treat an indicator?
What follows an active exact indicator match?