Hashing Fundamentals
Two files can look identical on screen and still differ by a single hidden bit. A cryptographic hash turns each file into a compact fingerprint, making those differences easier to detect. SHA-2 and SHA-3 are two major families built for this work—but despite their similar names and sometimes matching output lengths, they are distinct algorithms with different internal designs.
Hashens makes hashing practical to understand: not as mysterious code, but as a useful part of checking whether data has changed. This guide introduces the SHA families, explains where they fit, and offers a clear-eyed look at older names such as MD5 and SHA-1.
SHA stands for Secure Hash Algorithm. A SHA function accepts input of many possible sizes—such as a short message, a software download, or a large archive—and produces a hash value, also called a digest. A given algorithm produces a defined output length, and the same input processed with the same algorithm produces the same digest.
That consistency makes hashes useful for comparison. If a publisher provides a trusted SHA-256 digest for a download, you can calculate the digest of your own copy and compare the two. Matching values are strong evidence that the file matches the one represented by the publisher’s reference value. A hash is not encryption: it does not conceal the file or provide a way to recover the original input.
For a foundation in the broader idea, see Hashing Basics and How Hash Functions Work.
SHA-2 is a family of cryptographic hash functions standardized by the U.S. National Institute of Standards and Technology (NIST). It includes SHA-224, SHA-256, SHA-384, and SHA-512, among other variants. The number in a name generally indicates the digest length in bits: SHA-256 produces a 256-bit digest, while SHA-512 produces a 512-bit one.
SHA-2 became a familiar workhorse of modern computing. SHA-256, for example, is used in many systems and workflows that need a digest for integrity checking or as part of a larger cryptographic protocol. Its long history of broad use has made it common in developer tools, documentation, and file-verification instructions.
The word “family” matters: SHA-256 and SHA-512 are related, but they are not the same function. When checking a file, use the exact algorithm named by the trusted publisher. A digest calculated with SHA-256 cannot be compared directly with a SHA-512 reference.
SHA-3 is a separate family of standardized hash functions. Its best-known member, SHA3-256, also produces a 256-bit digest—but it is built using a different internal construction from SHA-256. SHA-3 is based on the Keccak design, selected after an open competition and standardized by NIST in 2015.
That history is part of the point. Cryptographic standards are not simply renamed when a new version appears: different designs can provide diversity, support different technical needs, and offer alternatives if concerns arise about one construction. SHA-3 adds another standardized option; it does not mean SHA-2 suddenly stopped working or that every system should switch.
Although SHA-256 and SHA3-256 have the same output length, their digests will generally differ for the same input. They are not interchangeable. A file’s reference value must be compared against a digest made with the same specified algorithm.
| Feature | SHA-2 | SHA-3 |
|---|---|---|
| Examples | SHA-256, SHA-512 | SHA3-256, SHA3-512 |
| Design | A family of functions using the SHA-2 construction | A distinct family based on the Keccak construction |
| Output length | Varies by variant | Varies by variant |
| Key takeaway | Same-length outputs do not make two algorithms equivalent. Match the algorithm as well as the digest. | |
The table is a starting point, not a full specification. Real implementations and protocols may have particular requirements, so follow the standard or trusted instructions relevant to your task.
MD5 and SHA-1 are older hash algorithms that still appear in archived instructions, legacy systems, and casual conversation. Their weaknesses are not just theoretical: practical collision attacks have demonstrated that different inputs can be crafted to produce the same digest. That makes them unsuitable where collision resistance is important, such as modern security-sensitive integrity checks or digital-signature uses.
A collision is when two different inputs produce the same hash value. Since a hash has a fixed-size output and can accept vastly more possible inputs, collisions must exist in principle. A secure cryptographic hash is designed to make finding a useful collision computationally infeasible. For MD5 and SHA-1, that security expectation no longer holds.
To learn more about why collisions matter, visit Hash Collisions Explained. For the difference between detecting accidental changes and resisting deliberate attacks, see Checksums and Hashes.
For everyday file verification, start with the algorithm specified by the software publisher or other trusted source. SHA-256 is widely supported and commonly provided for downloads. SHA-3 may be appropriate when a system or specification calls for it. The right choice depends on the context, compatibility needs, and applicable technical guidance—not simply on which name sounds newest.
Most importantly, a hash only helps when the reference value itself is trustworthy. If an attacker can replace both a downloaded file and the webpage listing its digest, matching values do not establish that the file is genuine. Obtain the reference through an authenticated, reputable channel, and follow the publisher’s verification guidance.
For step-by-step guidance, continue to Verify Downloaded Files or read Understanding Data Integrity.
It is tempting to call a digest a file’s “fingerprint.” The comparison is useful: a small change to a file should produce a very different digest, so hashes can help reveal that two copies are not the same. But a digest is not a unique identity guaranteed for every possible file. Collisions are mathematically possible, and the algorithm’s security properties determine whether finding one is realistically difficult.
That distinction reflects Hashens’ central idea: explain what a tool can do without asking it to do more. SHA-2 and SHA-3 can support robust integrity checks when used appropriately, but a plain hash does not prove who created a file, keep information secret, or guarantee that a reference value came from a legitimate source. Those questions require other protections and trustworthy processes.
For related topics, explore HMAC and Message Authentication and Merkle Trees Explained.