What is SHA? What is SHA used for?

SHA (Secure Hash Algorithm) is a family of cryptographic hash functions that convert data of any size into a fixed-length, unique value called a hash digest. It is one-way and uses no key, so it cannot be reversed. SHA is used to verify data integrity, protect passwords, and secure digital signatures and certificates.

SHA (Secure Hash Algorithm) is a family of cryptographic hash functions that turn any input into a fixed-length string of characters called a hash digest. Hashing is one-way and keyless: the same input always produces the same digest, but the digest cannot be reversed back into the input. SHA is used to check data integrity, store passwords safely, and underpin digital signatures and certificates.

Key Takeaways

  • SHA (Secure Hash Algorithm) is a family of one-way cryptographic hash functions that produce a fixed-length, unique hash digest from any input.
  • Hashing is not encryption: it is one-way and uses no key, so a hash cannot be decrypted back into the original data.
  • A tiny change in the input completely changes the output (the avalanche effect), which is what makes SHA ideal for detecting tampering.
  • SHA-1 is broken (the 2017 SHAttered collision attack) and deprecated. SHA-2 (including SHA-256) is the current standard, and SHA-3 is an alternative built on a different design.
  • SHA is used for data integrity, password storage, digital signatures and certificates, and blockchain. Every publicly trusted TLS certificate is signed with SHA-2.

What Is SHA?

SHA stands for Secure Hash Algorithm. It is a family of hash functions used to hash data and digital certificates. A hash function takes an input of any size and, using bitwise operations, modular additions, and compression functions, reduces it to a fixed-length output that cannot be read or reversed. The SHA family descends from the earlier MD (Message Digest) design lineage but is a distinct, stronger set of algorithms designed by the NSA and standardized by NIST.

SHA algorithm

Hashing Is Not Encryption
A common misconception is that hashing is a form of encryption. It is not. Encryption is two-way and uses a key: you encrypt with a key and decrypt with a key to recover the original data. Hashing is one-way and keyless: once data is hashed, the digest cannot be turned back into the input at all. There is no ‘decryption’ of a hash. The only way to find the input behind a hash is to guess inputs and hash them until one matches (a brute-force attack). This one-way property is exactly why hashing is used to verify integrity and store passwords, where you never need to recover the original, only to check whether a value matches.

The Avalanche Effect

SHA is designed so that even a single-character change in the input completely changes the output. Hashing the word ‘Heaven’ and the word ‘heaven’, which differ only by one capital letter, produces two completely different, unrelated hash digests. This property is called the avalanche effect, and it matters for two reasons: it prevents an attacker from inferring anything about the input from the digest, and it lets a recipient detect that a message was altered in transit, since any change at all produces a different digest.

SHA functions are also deterministic: the same input always produces the same digest, so anyone using the same SHA function can recompute and verify a hash. This determinism is one reason every publicly trusted TLS certificate on the internet must be hashed with a SHA-2 function.

Tailored Encryption Services

We assess, strategize & implement encryption strategies and solutions.

Learn More

The SHA Family: SHA-1, SHA-2, and SHA-3

Several names get used (SHA-1, SHA-256, SHA-512, and so on), but they belong to a few distinct generations. SHA-256 and SHA-512, for example, are simply variants of SHA-2 at different digest sizes.

AlgorithmDigest sizeStatus
SHA-1160-bitBroken and deprecated (SHAttered collision, 2017). Do not use.
SHA-2 (SHA-224/256/384/512)224 to 512-bitCurrent standard; SHA-256 most common. Secure.
SHA-3 (SHA3-256/384/512)224 to 512-bitAlternative to SHA-2, different internal design (Keccak). Secure.

SHA-1 (deprecated)

Introduced in 1993, SHA-1 was the original secure hash algorithm, producing a 160-bit digest. Its digest is too short by modern standards, which made collision attacks (finding two different inputs that produce the same hash) increasingly feasible. In 2017, Google and CWI researchers demonstrated a practical SHA-1 collision in the landmark SHAttered attack, confirming SHA-1 as broken. It is now deprecated and must not be used for security purposes.

SHA-2 (the current standard)

SHA-2 is the current industry standard, offering a family of digest sizes from 224 to 512 bits, with SHA-256 the most widely used. Its larger digests make collisions and brute-force attacks computationally infeasible with current technology. Since 2016, SHA-2 has been required for all publicly trusted digital certificates and digital signatures. The industry migration from SHA-1 to SHA-2 took years, since it required upgrading legacy systems, replacing certificates, and reconfiguring protocols, but SHA-256 is now the default for SSL/TLS certificates and digital signatures.

SHA-3 (the modern alternative)

SHA-3, standardized by NIST in 2015, is not a replacement for SHA-2 but an alternative built on a completely different internal design (the Keccak sponge construction). Because it works differently, it provides a hedge: if a structural weakness were ever found in SHA-2, SHA-3 would remain unaffected. It was not adopted widely at release because most organizations were still moving from SHA-1 to SHA-2, and SHA-2 remained secure. SHA-3 can be slower in software but is efficient in hardware. Both SHA-2 and SHA-3 are considered secure today.

What Is SHA Used For?

SHA appears throughout modern security, usually behind the scenes. Its main uses:

  • Digital signatures and certificates: SHA-2 is required for all TLS/SSL certificates and digital signatures. The data is hashed, and the hash is what gets signed, which is faster and safer than signing the whole message.
  • Data integrity: A file’s hash acts as a fingerprint. If the file changes in transit or storage, its hash no longer matches the original, revealing tampering or corruption.
  • Password storage: Systems store the hash of a password, not the password itself. At login, the entered password is hashed and compared. If the database is stolen, attackers get hashes, not usable passwords (especially when salted).
  • Secure protocols: SSH, S/MIME, and IPsec all use SHA functions as part of their security.
  • Blockchain: SHA-256 is central to Bitcoin, where it secures the mining process and links blocks in the chain.

Why Use SHA?

  • Resistance to attack: A password hashed with SHA-2 can take years or decades to brute-force, discouraging attackers and protecting stored credentials.
  • Uniqueness (collision resistance): With SHA-2, distinct inputs produce distinct digests in practice, so there is no pattern an attacker can exploit.
  • Integrity verification: Any change to the data, however small, produces a completely different hash, making tampering easy to detect.
  • Determinism and speed: The same input always hashes to the same value, quickly, so verification is efficient and reliable.

SHA and the Post-Quantum Transition

Unlike the public-key algorithms RSA and ECC, hash functions are relatively resilient to quantum computers. The relevant quantum attack (Grover’s algorithm) provides only a quadratic speedup, effectively halving a hash’s security level rather than breaking it outright. In practice this means SHA-256 and above remain secure, with SHA-384 and higher recommended for the highest-assurance and long-term uses. Hash functions also play a direct role in post-quantum cryptography: the NIST standard SLH-DSA (FIPS 205) and the stateful schemes LMS and XMSS build digital signatures entirely out of hash functions, precisely because hashing is so well understood and quantum-resistant.

Tailored Encryption Services

We assess, strategize & implement encryption strategies and solutions.

Learn More

How Encryption Consulting Helps

Using the right hash functions, and retiring weak ones like SHA-1 and MD5, is part of a sound cryptographic posture. Encryption Consulting’s Encryption Advisory Services help organizations assess where hashing is used, identify deprecated algorithms, and align hashing, signing, and certificate practices to NIST and FIPS guidance, including preparation for the post-quantum transition. Backed by ISO/IEC 27001:2022 and SOC 2 certified practices.

Frequently Asked Questions

Strengthen Your Hashing and Certificate Practices

Using current hash functions and retiring weak ones is a small change with a big security payoff. Explore Encryption Consulting’s Encryption Advisory Services to assess your hashing, signing, and certificate practices against current standards.

Every Layer of Cryptography.
One Team to Secure It.

See how Encryption Consulting secures what your enterprise depends on, from assessment through deployment.

Request a Demo