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
67
21
5 days ago 00:04:49 1
Play To Earn🔥This New Play to Earn Game is About to Make a Lot of People RICH
3 weeks ago 00:13:21 1
Religions and babies | Hans Rosling
3 weeks ago 00:39:19 1
Historian Answers Witchcraft Questions | Tech Support | WIRED
4 weeks ago 00:10:50 1
Best LLC Services of 2024: Watch Before You Buy!
4 weeks ago 00:20:01 3
Boob Armor: 4 Things You Need to Know
4 weeks ago 00:00:17 1
How does anyone find that funny (bad to the bone)
4 weeks ago 00:57:07 1
How the pro-Israel lobby influences US policy during Gaza war | Stephen Walt | Real Talk
4 weeks ago 00:39:35 1
He QUIT CHESS for college, now he’s TOP 8! WEI YI Podcast
4 weeks ago 00:01:22 1
No one’s around to help.
4 weeks ago 00:03:05 1
Jeorgia Rose - Undertone (Official Music Video)
4 weeks ago 00:10:47 1
Why A Record Number of CEOs Are “Resigning“
4 weeks ago 00:21:14 1
Can You Beat Baldur’s Gate 3 While Locked In First Person PoV?
4 weeks ago 00:53:47 2
Myths BUSTED! Brave German Journalist EXPOSES Ukraine/NATO War Lies.
4 weeks ago 00:05:35 1
Michael Jackson - Stranger In Moscow (Official Video)
4 weeks ago 00:00:58 1
Does ROSÉ & Bruno Mars’ “APT.” Sound Familiar? 🍾🤔 #rosé #brunomars #music
4 weeks ago 00:11:29 1
How much does an adult leopard weigh 🤔😁(ENG SUB)
4 weeks ago 00:04:16 1
BTS - Come Back Home (remake) live at 4th Muster 2018 [ENG SUB] [Full HD]
4 weeks ago 00:05:55 1
“Where Do I Begin” (Love Story)
4 weeks ago 00:03:04 1
Best One Piece Bounty Rush Hack - Working Way to Get Unlimited Rainbow Diamonds with iOS/Android MOD
4 weeks ago 00:13:35 1
Russia’s DONE With G7 Gold - BRICS Precious Metals Exchange Threatens The U.S. & UK
4 weeks ago 00:13:34 1
G7 Banking Giant Joins China’s RMB Payments System, Bypassing USD In Global Trade
4 weeks ago 00:04:57 1
“До МУРАШЕК пение Пелагеи“ - спорт. комментатор матча ЦСКА-Спартак
4 weeks ago 00:03:10 1
KADEBOSTANY - Walking Away feat. Alex Sid & Naile (Visualizer)