Digital Forensics Lab: Entropy, Carving and Hashes

Investigate a fictional disk image: spot encrypted data by entropy, recover deleted file headers, and detect a modified program with SHA-256.

Investigation steps

Entropy scan: measures how random each block looks. Text is low, encrypted or compressed data is near 8 bits/byte. Carving: looks for known file-type signatures (magic numbers) even in space the file system says is free. Hash: a fingerprint; any change in the file changes it completely.

Case: a (fictional) office laptop. Find the hidden container, the deleted files, and the tampered program.

The science

Shannon entropy per block: H = -Σ pi log2 pi (max 8 bits/byte). For n random bytes the estimate is biased low by (256-1)/(2 n ln 2) (Miller-Madow), so 2048-byte random blocks read ~7.91 bits, not 8.

SHA-256 is implemented from the FIPS 180-4 specification and verified against the NIST test vectors; it also shows the avalanche effect (~half of the 256 output bits flip on a one-character change).

File carving matches magic numbers (JPEG FF D8 FF, PNG 89 50 4E 47, PDF 25 50 44 46, MZ 4D 5A). Deleting a file normally only frees its blocks; the bytes remain until overwritten.

Simplifications: synthetic random data instead of real file formats, no file-system metadata, no timestamps or network logs, no malware. Educational only; no real attack techniques.

Educational model with deliberate simplifications. Pure Canvas 2D, no external assets.