A hash function is a one-way algorithm that takes input of any size and produces a fixed-length output called a hash or digest. The same input always yields the same digest, yet changing even a single bit produces a completely different result. That property makes hashing the standard way to verify integrity, since a matching hash means the data hasn’t been altered in transit or storage.
How does a hash function work?
The function processes input in blocks and compresses each one into an internal state, so a 4 GB disk image and a 10-character password both come out as, say, 256 bits with SHA-256. SHA-2 uses a Merkle-Damgård construction. SHA-3, standardized in FIPS 202 in August 2015, uses a different “sponge” design based on the Keccak algorithm, which gives NIST a backup family that doesn’t share SHA-2’s internal structure.
A cryptographic hash needs three qualities. It should be preimage resistant, so you can’t work backward from a digest to the input. It should be second preimage resistant, so you can’t find a different input matching a known one. And it should be collision resistant, so it’s computationally infeasible to find two different inputs that share a digest.
What is a birthday attack?
Collision resistance is weaker than the output length suggests. Because of the birthday paradox, finding any two inputs with the same n-bit digest takes roughly 2 to the power of n/2 attempts, not 2 to the n. In a room of just 23 people, the odds that two share a birthday pass 50%. For SHA-256 that means about 2^128 work for a collision, which is still far out of reach. For a 128-bit hash like MD5 it means about 2^64, and real attacks on MD5 are much faster than even that. The practical rule is that a hash gives roughly half its output length in collision security, so pick the digest size accordingly.
What is the difference between a hash, a MAC, and a digital signature?
All three use hashing, and the exam likes to test which one fits a stated need.
| Mechanism | Key used | Integrity | Authenticity | Non-repudiation |
|---|---|---|---|---|
| Plain hash (SHA-256) | None | Yes, if the hash is delivered safely | No | No |
| MAC / HMAC | Shared secret key | Yes | Yes | No |
| Digital signature | Sender’s private key | Yes | Yes | Yes |
The non-repudiation column is the usual trap. With an HMAC, either party holding the shared key could have produced the tag, so the sender can plausibly deny it. Only a signature made with a private key that one person controls ties the message to that person.
Which hash algorithms should be used?
SHA-256 and SHA-3 are the current workhorses, both approved by NIST, along with SHA-384 and SHA-512 for higher security margins. MD5 and SHA-1 are broken and should never protect anything new. NIST disallowed SHA-1 for generating digital signatures in 2013 and plans to remove it from FIPS 180 entirely by December 31, 2030.
For passwords, general-purpose hashes are the wrong tool because they’re fast. Password storage calls for salted, deliberately slow functions such as bcrypt, PBKDF2, or Argon2, so an attacker who steals the database can test only a limited number of guesses per second.
How are hash functions tested on the CISSP exam?
Hashing is covered in Domain 3: Security Architecture and Engineering, which carries 13 percent of the exam. Objective 3.6 ties hashing to digital signatures, integrity, and non-repudiation, and objective 3.7 includes brute force and pass-the-hash attacks. Know the required properties, the applications like password storage and signatures, and which algorithms are deprecated.
The classic exam trap is confusing hashing with encryption. Hashing isn’t reversible and uses no key, so it delivers integrity, not confidentiality. If a question asks how to confirm that a log file archived last year hasn’t changed, hashing is the answer. If it asks how to prove who sent a contract, a hash alone falls short and you need a digital signature.
See FIPS 180-4, Secure Hash Standard, and FIPS 202, SHA-3 Standard for the SHA-3 family.
Related terms: Cryptographic Hash, Encryption