Blockchain & Cryptocurrency Glossary

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

  • search-icon Clear Definitions
  • search-icon Practical
  • search-icon Technical
  • search-icon Related Terms

SHA-256

2 min read
Pronunciation
[es-eych-ey too fif-tee siks]
Analogy
SHA-256 works like a document shredder with very specific properties—it takes documents of any size and turns them into precisely 32-byte confetti piles. No matter how big or small the original document, the confetti pile is always exactly the same size. The slightest change to the original document (even a single comma) creates an entirely different confetti pattern, and it's practically impossible to reconstruct the original document from the confetti.
Definition
A cryptographic hash function that produces a 256-bit (32-byte) hash value, widely used in blockchain systems particularly Bitcoin. SHA-256 (Secure Hash Algorithm 256-bit) is part of the SHA-2 family developed by the NSA and published by NIST.
Key Points Intro
SHA-256 provides the cryptographic backbone for Bitcoin and many other blockchain systems.
Key Points

Transforms data of any length into a fixed 256-bit (32-byte) output.

Forms the core of Bitcoin's proof-of-work mining algorithm and transaction verification.

Produces drastically different outputs even when inputs differ by a single bit.

Considered cryptographically secure against current computing capabilities.

Example
In Bitcoin mining, miners repeatedly modify a block header and calculate its SHA-256 hash (actually applying the function twice in sequence) until they find a hash value with a specific number of leading zeros, proving they've performed the computational work required to validate a block.
Technical Deep Dive
SHA-256 processes messages in 512-bit blocks after padding the input to appropriate length and appending the original message length. The algorithm initializes with eight 32-bit words derived from the square roots of the first eight prime numbers, creating a seemingly random but verifiable starting state. Each message block undergoes 64 rounds of processing using the compression function, which applies a mixture of bitwise operations (AND, OR, XOR, rotations) and modular addition. These operations thoroughly mix the message into the intermediate state, creating the strong avalanche effect where a single bit change propagates unpredictably through the entire hash. Bitcoin applies SHA-256 twice (SHA-256d) for additional security, while many derived cryptocurrencies use alternative hashing algorithms (like Scrypt or Equihash) specifically designed to resist ASIC optimization, though others like Bitcoin Cash and Bitcoin SV maintain the original SHA-256 algorithm.
Security Warning
While SHA-256 remains secure against current attacks, implement it correctly. Common implementation mistakes include not handling data encoding properly, insufficient input validation, or improper processing of multiple data segments, which can lead to issues like length extension attacks in some applications.
Caveat
SHA-256, like all fixed-output hash functions, is theoretically vulnerable to collision attacks due to the pigeonhole principle, though finding actual collisions remains computationally infeasible. Additionally, quantum computing advances may eventually necessitate migration to quantum-resistant alternatives.

SHA-256 - Related Articles

No related articles for this term.