← Articles
Digital forensics
Cover of article Hash: The Digital Fingerprint of Data and Its Importance in Digital Forensics

Hash: The Digital Fingerprint of Data and Its Importance in Digital Forensics

Learn what hashes are, how a simple illustrative calculation works, why changing one bit affects SHA-256, what hexadecimal letters mean, and which algorithms have known collisions.

By Custodia Systems ·

HASH: THE DIGITAL FINGERPRINT OF DATA AND ITS IMPORTANCE IN DIGITAL FORENSICS Imagine receiving a file and needing to determine whether it is exactly the same as the original. Names, sizes, and dates are not enough: two files may look identical but contain different data. A cryptographic hash function transforms data of any size into a fixed-length sequence that can be used to check integrity. 1. WHAT IS A HASH? A hash is the output of a deterministic mathematical function: the same input always produces the same output. SHA-256, for instance, generates 256 bits, usually displayed as 64 hexadecimal characters. Hashing is not reversible encryption: there is no key that reconstructs the original file from its hash. Modern cryptographic hash functions aim for preimage resistance, collision resistance, and the avalanche effect. 2. A MADE-UP ALGORITHM TO UNDERSTAND THE CALCULATION Let's invent a simple algorithm for educational purposes only. Rules: convert each letter into its alphabet position (A=1 through Z=26); multiply that value by the letter's position in the word; add the products; divide by 100 and take the remainder as the hash. For CASA: C = 3 × 1 = 3 A = 1 × 2 = 2 S = 19 × 3 = 57 A = 1 × 4 = 4 Sum = 3 + 2 + 57 + 4 = 66. Remainder after division by 100 = 66. Fictitious hash of CASA = 66. Now change just the last letter, producing CASO: C = 3 × 1 = 3 A = 1 × 2 = 2 S = 19 × 3 = 57 O = 15 × 4 = 60 Sum = 122. Remainder after division by 100 = 22. Fictitious hash of CASO = 22. Changing one letter changed the output. However, this algorithm is not secure: it has only 100 possible outputs, collisions are easy to find, and it lacks the properties required for cryptographic use. It was invented solely to illustrate the concept. Real algorithms work on bytes and bits and use much more sophisticated operations. 3. HOW DOES SHA-256 WORK? First, the data is represented as bits. SHA-256 appends padding and the original message length, then processes 512-bit blocks. Each block undergoes 64 rounds involving rotations, XOR, AND, and modular additions. The final state consists of eight 32-bit words, totaling 256 bits. Processing can be incremental, without loading the entire file into memory. 4. CHANGING A SINGLE BIT The letter A in ASCII/UTF-8 is 01000001; C is 01000011. Only one bit differs. Yet their SHA-256 values are: A: 559aead08264d5795d3909718cdd05abd49572e84fe55590eef31a88a08fdffd C: 6b23c0d5f35d1b11f9b683f0b0a617355deb11277d91ae091d399c655b87940d This illustrates the avalanche effect: in a well-designed hash function, changing one input bit tends to change approximately half the output bits, not necessarily all of them. 5. WHY DOES A HASH CONTAIN LETTERS? Bits are commonly written in hexadecimal, a base-16 number system using 0–9 and A–F. A means 10, B means 11, and F means 15. Each hexadecimal digit represents four bits, so 256 bits fit into 64 characters. The letters are not words or hidden messages: they are numerical digits in base 16. 6. COLLISIONS: DIFFERENT CONTENT, THE SAME HASH A collision occurs when two different inputs produce the same hash. Since outputs have a fixed size, collisions are mathematically inevitable. SHA-256 has 2^256 possible outputs, approximately 1.16 × 10^77. For an ideal 256-bit hash, a generic collision search requires on the order of 2^128 attempts due to the birthday paradox. Popular algorithms: MD5 — 128 bits; practical collisions are known; unsuitable where cryptographic collision resistance is needed. SHA-1 — 160 bits; practical collisions have been demonstrated. SHA-224 — 224 bits; no practical collision known for the full algorithm. SHA-256 — 256 bits; no practical collision known for the full algorithm. SHA-384 — 384 bits; no practical collision known for the full algorithm. SHA-512 — 512 bits; no practical collision known for the full algorithm. SHA3-256 — 256 bits; no practical collision known for the full algorithm. BLAKE2b — up to 512 bits; no practical collision known for the full version. Researchers demonstrated MD5 collisions in 2004. In 2008, MD5 weaknesses were exploited in an attack involving digital certificates. In 2017, Google and CWI unveiled SHAttered: two different PDF files with the same SHA-1 hash. MD5 and SHA-1 should not be chosen for new applications requiring cryptographic collision resistance. 7. HASHES IN DIGITAL FORENSICS Imagine transferring a 100 GB digital evidence file. Calculate SHA-256 for the source and then for the received copy. Different hashes mean different contents. Matching hashes provide extremely strong evidence that the contents match, assuming a secure algorithm. A hash alone, however, does not establish authorship, origin, creation date, or authenticity before the initial calculation. Audit logs, digital signatures, timestamps, and chain-of-custody documentation complement integrity verification. 8. HOW TO CALCULATE A HASH Windows PowerShell: Get-FileHash "C:\files\document.pdf" -Algorithm SHA256 Linux: sha256sum document.pdf The hash depends on file contents, not its name or folder. CONCLUSION A hash does not prevent changes; it helps detect them by comparison against a trusted reference. Algorithm selection matters: SHA-256 and SHA-512 remain established choices, while MD5 and SHA-1 have known practical collisions. TECHNICAL REFERENCES NIST FIPS 180-4: https://csrc.nist.gov/pubs/fips/180-4/upd1/final NIST Hash Functions: https://csrc.nist.gov/projects/hash-functions Google SHAttered: https://security.googleblog.com/2017/02/announcing-first-sha1-collision.html CERT MD5: https://www.kb.cert.org/vuls/id/836068

Explore articles →

We respect your privacy. You can accept or decline optional cookies, according to our Privacy Policy.

By accepting, you authorize all cookies described in the policy. If you decline, we keep only necessary cookies. You can change your choice in the footer.