An explanation of how SHA-256 works, with animations of the operations used inside the hash function.
I’m not a cryptographer though, so I can’t explain the reasons behind the design (at the moment).
00:00 - Introduction
↳ 02:20 - Bitcoin Mining
05:05 - Basic Operations
08:27 - Functions
10:58 - Constants
12:23 - Hash Computation
↳ 12:41 - Message
↳ 13:19 - Padding
↳ 14:24 - Message Blocks
↳ 14:58 - Message Schedule
↳ 17:42 - Compression
↳ 22:30 - Final Hash Value
Source code for animations (and text guide):
Official specification:
====
FAQs:
====
=== What setup are you using for your computer? ===
* Operating System = Ubuntu (Xubuntu)
* Desktop Environment = XFCE
* Appearance Style = Arc-Dark
* Appearance Icons = Papirus-Dark
* Window Manager Style = Numix
* Wallpaper = A simple gradient from dark grey to grey.
* Shell = zsh (using zsh-autosuggestions)
* Terminal Font = Hack Regular
=== How do you work out the constants? ===
The constants are created using the first 32 bits from the fractional part of the cube roots of prime numbers.
For example, the first constant is the cube root of the first prime number (2), so:
∛2 =
The fractional part of this is:
=
However, we want 32 bits’ worth of this fractional part. To get these 32 bits, we multiply the fraction by 2^32:
=
The integer part of this is our 32-bit constant, which we can convert to binary:
= 1116352408
= 0b01000010100010100010111110011000
Here’s some code showing how it works:
=== How does the padding work if my message is X bits in length? ===
Lets say we have a message that is exactly 448 bits.
We always need to include the `1` separator and the 64 bit message size in the padding, which takes the message padding up to 513 bits. This exceeds the 512 bit message block size we’re after, so we pad with 511 zeros to take us up to 1024 bits (the next multiple of 512).
The zeros go between the separator and the size, like so:
[message] [separator] {zeros} [size]
So in other words, if your message and the initial padding takes you beyond the size of a message block, you pad all the way up to the next multiple of 512.
1 view
51
20
2 weeks ago 00:50:40 1
Загадка скрипок Страдивари -документальный фильм Violin Stradivarius
3 weeks ago 00:20:15 2
Karoline Leavitt’s Lifestyle 2025★ House Tour, Husband, Children, Cars, Net Worth....
1 month ago 01:07:38 5
* Slade |FHD| *
1 month ago 00:08:01 1
Lifelong electricity-free water pump using a water hose
1 month ago 00:21:58 43
On Writing with Sergey & Jill, part 1
2 months ago 01:12:10 1
Erik Prince - War Will Never Be The Same
2 months ago 00:06:00 8
What Is International Women’s Day?
2 months ago 00:14:37 1
🔴 As US Cozies Up To Russia’s Economy, Putin’s Call With China Just Changed Everything
2 months ago 01:01:39 1
TIME SLIP STORIES (SN 18 EP 38) TRUE UNEXPLAINABLE EXPERIENCES WITH MISSING TIME & TIME SLIPS
3 months ago 00:05:22 1
The First Signs of Tyranny, From People Who Missed Them | NYT Opinion
3 months ago 00:31:53 8
Tokyo Xtreme Racer - Customizing and Fully Upgrading 350Z
3 months ago 00:11:54 1
Taj Experience | Taj Holiday Village Resort & Spa | Goa | The Offbeat Couple
3 months ago 00:06:39 1
How to Make Perfect Sourdough Dinner Rolls: Beginner-Friendly Recipe
3 months ago 00:50:14 1
IS THE BIBLE A COPY OF SOMEONE ELSE’S BOOK? | APOLOGIST CONFRONTS MESOPOTAMIAN SOURCES | PAUL WALLIS
3 months ago 00:10:43 1
California Games (NES) Playthrough - NintendoComplete
3 months ago 00:10:30 1
Snow-biking on the Surly Moonlander: How does it ride in the white stuff?
3 months ago 01:02:45 1
You Won’t Believe The ENGINE I’m Putting Into My Russian Buhanka Bread Van! #Буханка #уаз
4 months ago 00:14:26 1
Daily Contour/Sculpting Gua Sha - Follow Along Tutorial
4 months ago 00:08:22 2
🏆 Soaring to New Heights: Embla Matilde Njerve’s Rise to Fame! 🇳🇴 #podcast #SportyChicChat
4 months ago 00:10:44 1
How to Form an LLC in Michigan (Step by Step Guide) | Michigan LLC 2024 Setup
4 months ago 00:10:37 1
How to Form an LLC in Washington (Step by Step Guide) | Washington LLC 2024 Setup
4 months ago 00:10:38 1
How to Form an LLC in Maryland (Step by Step Guide) | Maryland LLC 2024 Setup
4 months ago 00:04:51 1
PUPrime vs IC Markets : Battle of the Best Forex Brokers for 2025!