Cryptographic hashing in threat intelligence and DFIR
A cryptographic hash function turns input of any size into a short value of fixed length, called a digest. The same input always gives the same digest, a tiny change gives a completely different one, and the input cannot be worked out from the result. Those properties make digests useful in several parts of security work:
- Threat intelligence. A file hash identifies an exact malware sample across vendors, sandboxes and feeds without sharing the sample itself.
- Detection. EDR and application control products block or allow files by digest.
- Evidence integrity. Examiners hash a disk image at acquisition and again later to show that it has not changed.
- Known-file filtering. Hash sets of operating system files remove thousands of irrelevant items from a forensic review.
- Credential storage. Systems store password hashes so that the password itself does not need to be kept.
File hashes are precise but fragile. Changing one byte gives a new digest, so attackers can avoid hash matching at almost no cost. Treat them as strong confirmation of a known sample and weak protection against a new one.
How hash identification works
Some formats announce themselves. Modular crypt strings begin with a signature such as $2b$ for bcrypt,
$6$ for SHA-512crypt or $argon2id$ for Argon2, and they carry their own salt and cost settings.
Identification of these is reliable. Others have a distinctive structure. A NetNTLMv2 response contains a user, a domain, a
challenge and two hex fields separated by colons.
Plain hex digests carry nothing but their length. Every algorithm with the same output size looks the same, so the result is a list of candidates ordered by how common they are.
| Hex characters | Bits | Candidates |
|---|---|---|
| 8 | 32 | CRC32 (a checksum, not a cryptographic hash) |
| 16 | 64 | MySQL323, half of an LM hash |
| 32 | 128 | MD5, NTLM, MD4, LM |
| 40 | 160 | SHA-1, MySQL 4.1+, RIPEMD-160 |
| 56 | 224 | SHA-224, SHA3-224 |
| 64 | 256 | SHA-256, SHA3-256, Keccak-256 |
| 96 | 384 | SHA-384, SHA3-384 |
| 128 | 512 | SHA-512, SHA3-512, Whirlpool |
Why MD5 and NTLM are both 32 hex characters
The resemblance comes from shared ancestry. An NTLM hash is MD4 applied to the password encoded as UTF-16LE, with no salt. Ronald Rivest designed MD4 in 1990 and MD5 as its successor in 1991, and both output 128 bits. Written in hex, 128 bits is 32 characters, so nothing in the text shows which one produced it.
The difference matters a great deal during an incident. An MD5 of a file is an ordinary indicator. An NTLM hash is a credential that works in pass-the-hash attacks without being cracked, so one found in attacker tooling or a paste site means that the account needs a password reset. NetNTLMv1 and NetNTLMv2 are different again. They are challenge responses captured from the network. They can be relayed or cracked, but they cannot be used for pass-the-hash.
Some values are worth memorizing because they resolve the ambiguity at a glance:
| Value | Meaning |
|---|---|
d41d8cd98f00b204e9800998ecf8427e | MD5 of empty input |
31d6cfe0d16ae931b73c59d7e0c089c0 | NTLM of an empty password |
aad3b435b51404eeaad3b435b51404ee | Empty LM hash |
If the first value appears in a malware report, the collection step read an empty file. Do not add it to a blocklist.
SHA-256 or MD5 for malware indicators
Use SHA-256 as the primary identifier. Practical MD5 collisions have been public since 2004, which means that someone can prepare two different files with the same MD5. SHA-1 fell to a public collision in 2017. An attacker can use a collision to make a harmless file and a malicious one share an identifier, which defeats allow lists and confuses evidence. No practical collision for SHA-256 is known.
MD5 and SHA-1 still have a place. Older reports, case files and tools may offer nothing else, and an accidental match is still extremely unlikely. Record all three when you catalog a sample, search with whichever the source uses, and confirm with SHA-256 before you act.
None of these should be used to store passwords. They are designed to be fast, which helps an attacker guess. Password hashing needs a deliberately slow, salted function such as Argon2id, scrypt or bcrypt.
Workflow examples
Verify a downloaded binary locally
- Get the published checksum from the vendor over HTTPS, ideally from a different host than the download.
- Open Hash Verifier and paste it as the expected checksum. The algorithm is chosen from its length.
- Drop the file. The result states whether it matches and which algorithm was used.
- If it does not match, do not run the file. Download it again and compare before assuming tampering.
Record a malware sample without uploading it
- Work in an isolated analysis environment. Hashing only reads the file, but handling live malware still carries risk.
- Open Hash Generator and drop the sample.
- Copy the SHA-256 into your ticket and search for it in your EDR and threat intelligence sources.
- Search by hash before you submit a file to a public service. An upload can tell the attacker that a targeted sample has been found, and it may expose confidential content.
Triage a credential dump
- Paste the lines into Hash Identifier. The NT field is extracted from pwdump lines.
- Look for empty-password hashes and for the same NTLM value on several accounts, which means a shared password.
- Reset the affected accounts. Remember that NTLM hashes can be used without being cracked.
Accuracy and limits
Hashcat modes and John format names were checked against the source code of both projects. Where no exact equivalent was
confirmed, the tool shows "n/a" instead of a guess. Versions differ, so check the help output of your own copy. The tool
recognizes common formats and does not cover every application-specific hash. Salted hex digests such as
hash:salt do not reveal how the salt was combined, and that has to come from the application.
Text is hashed as UTF-8 exactly as it appears in the box, with line breaks as a single line feed. A result that differs
from a command-line tool usually comes from a trailing newline. For example, echo adds one and
printf does not.
Can this tool crack or reverse a hash?
No. It identifies formats and computes digests. Hash functions are one-way, and recovering an input means guessing candidates and hashing each one. The Hashcat mode and John format are shown to help authorized testers configure those tools, and you should use them only on hashes you have permission to test.