Security Operations
An analyst runs grep -Eo against a threat report to extract only SHA-256 hashes. Which pattern does this?
Show the answer
Correct answerC. \b[a-fA-F0-9]{64}\b
AWhy not this: The range {1,64} matches any hex string up to 64 characters, so it also returns MD5 and SHA-1 values.
BWhy not this: Exactly 40 hex characters is the length of a SHA-1 hash, not SHA-256.
CWhy this is right: The hex class with exact quantifier {64} matches only strings of 64 hex characters, the SHA-256 length.
DWhy not this: Exactly 32 hex characters is the length of an MD5 hash, not SHA-256.
A SHA-256 hash is 64 hexadecimal characters, so a hex character class with the exact quantifier {64} between word boundaries matches it. The {1,64} quantifier is tempting but also matches shorter hex strings such as MD5 or SHA-1 hashes.