Crypto
2 min read

SHA-256

A cryptographic hash function in the SHA-2 family that produces a 256-bit output. SHA-256 underpins Bitcoin mining and many other security-critical systems.

What SHA-256 does

The function:

  • Takes input of any size and produces 256-bit (32-byte, 64 hex character) output.
  • Deterministic — same input always produces same output.
  • One-way — given output, finding input is computationally infeasible.
  • Avalanche effect — small input changes produce drastically different outputs.
  • Collision-resistant — finding two inputs with same output is infeasible.

These properties make it suitable for cryptographic security uses.

Where SHA-256 is used

In Bitcoin specifically:

  • Block hashing — every block's identifier is its SHA-256 hash.
  • Mining — miners compete to find blocks whose hashes meet difficulty target.
  • Transaction IDs — each transaction has SHA-256 identifier.
  • Merkle trees — block transactions organized through SHA-256 hashing.
  • Address derivation — Bitcoin addresses use SHA-256 in derivation chain.

Beyond Bitcoin, SHA-256 is widely used:

  • TLS/HTTPS for internet security.
  • Git for commit identifiers.
  • Software distribution for integrity verification.
  • Many blockchains beyond Bitcoin.

Origins

A few facts:

  • Designed by NSA as part of SHA-2 family.
  • Standardized by NIST (US National Institute of Standards and Technology).
  • Public algorithm — anyone can implement.
  • Extensive cryptanalysis — no significant weaknesses found.

The combination of NSA design and decades of public scrutiny has produced strong confidence in its properties.

Performance

A few characteristics:

  • Software performance — fast on modern CPUs.
  • Hardware acceleration — Intel SHA extensions, ARM crypto extensions support fast hardware computation.
  • ASIC implementations — Bitcoin mining hardware is dedicated SHA-256 processors.

The performance characteristics affect both legitimate uses and mining hardware design.

Quantum considerations

A specific concern:

  • Symmetric primitives like SHA-256 are believed quantum-resistant.
  • Quantum attack would require ~2^128 operations (square root of classical) — still infeasible.
  • Asymmetric primitives (signatures) are more vulnerable.

Bitcoin's SHA-256 is likely safe even against future quantum computers; signature schemes may need replacement.

What individuals should know

For most users, SHA-256 operates invisibly:

  • Bitcoin works because of SHA-256's properties.
  • Most internet security depends on SHA-256.
  • Continued security of SHA-256 affects many systems.

For broader understanding:

  • Hash functions are fundamental cryptographic primitives.
  • Specific functions (SHA-256, Keccak, BLAKE3) have similar roles but different specifics.
  • Quantum resistance is one of the security properties to consider.

SHA-256 is foundational infrastructure underlying Bitcoin's existence and broader cryptographic security. Its sustained reliability since 2001 (when it was standardized) reflects strong design and extensive vetting.