BEFORE MY FIRST SOC ROLE

Cryptographic image hashing

My University of Sunderland dissertation on identifying known images through cryptographic hash matching.

Back to projects

Why I chose it

While I was at university, I landed a role in Durham Constabulary’s Digital Forensics Unit. That experience sparked my passion for digital forensic investigation and inspired my dissertation, Cryptographic Image Hashing for CSAM Detection.

In simple terms, I built a program that takes an image file, generates both a SHA-256 and an MD5 hash, and saves those values to a database. If a file is submitted later, the program hashes it again and checks the database to see whether an exact match already exists.

My aim was to explore the principle behind using known-image hash lists to help identify previously recorded material, inspired by the Child Abuse Image Database (CAID). I reproduced that basic matching process in a university prototype using demo files. The screenshots below show those demo files and how the tool works.

Application screenshots

I built three main tabs in PyQt5: Main, Library and Help. Main lets the user create a database, check a file or add a file. Library provides previews and database editing. Help explains each workflow. I also wrote a README and user guide.

Image hashing tool Main tab with create database, check image and add image controls
The Main tab offers three actions and previews the selected demo image. Open full size
Image hashing tool Library tab listing demo PNG files
The Library tab lets the user review entries and save changes. Open full size

Program flow and decisions

The application separates the PyQt5 interface, hashing logic and CSV database handling. The flowchart shows four choices and the decision the tool makes during a lookup.

  • Create a database. Scan a folder, hash each image with Python’s hashlib and save the digests to CSV.
  • Add an image. Select and preview a file, calculate its hashes, copy it into the known-image folder and update the database.
  • Check an image. Hash the selected file and compare its digests with the stored records. The interface reports whether it found an exact match.
  • Manage the database. View entries, remove them and save changes. The CSV can also be edited directly.
Flowchart branching into create database, add image, check for a match and manage database
The original program flowchart shows where the match decision fits into the workflow. Open full size

Testing and results

I developed the tool in three prototypes, testing repeatability as I added functionality.

  1. Prototype 1. I hashed one image three times and obtained identical values.
  2. Prototype 2. I stored hashes for 23 images in the database and checked them across three runs. The results were consistent.
  3. Prototype 3. I added MD5 alongside SHA-256, built the GUI and repeated verification three times.

I observed no false positives, false negatives or collisions in the dissertation test set. The 23-image figure applies to Prototype 2. Exact hashing checks whether file bytes match a known entry. A visually similar image can produce a different hash after editing or re-encoding.

Dissertation test records showing repeated cryptographic hash values
Original records from the repeatability checks. Open full size
Sample rows with demo PNG filenames and SHA-256 and MD5 digests
Example test output showing the two digests alongside each filename. Open full size

Viva poster

Dissertation viva poster covering the aim, methodology, system design, test results and future work
The original viva poster summarises the three prototypes and the scope of their results. Open full size