Live data from Hacker News

Show HN: SHA-256 Animation

github.com

41–50 of 105 posts

Re: Show HN: SHA-256 Animation

#43
post #2

I wanted to understand how SHA-256 works, so I made a terminal animation that shows the bitwise operations at each step. I wrote a text guide in the README.md to explain what's going on. I think my technical terminology is okay. I'm new to hash functions though, so I don't yet know why SHA-256 has been designed in the way it has (e.g. why exact numbers were chosen in the bitwise rotations). As far as I understand, th…

There's nothing particularly special about the constants. They needed a set of n constants to work with and the "cube root of first n primes, truncated" scheme is a "nothing up my sleeve"[0] construction. If they'd used magic numbers with no obvious generation scheme, you'd be left wondering if that was done as a way to put a back door in place. [0] https://en.wikipedia.org/wiki/Nothing-up-my-sleeve_number

That's also the explanation the author gives in chapter 4.

I'm more interested in how they came up with the parameters for the sigma functions. I'm sure it's described somewhere.

Re: Show HN: SHA-256 Animation

#44

I once heard about a meeting where someone did a presentation for the best part of an hour to a room full of Japanese people. They all nodded along, smiling as the presentation progressed. It wasn’t until the end that the presenter asked them what they thought. They all just kept smiling, but no answer. Someone at the front turned and talked to the room (in Japanese) then turned to the presented and said “they do not…

Did you see the README.md? It explains each of the steps.

Re: Show HN: SHA-256 Animation

#45
I was surprised to see addition in there.

Hash functions use bit-wise operators. This is a world where "integers" are simply convenient fixed-sized blobs of bits and all bits are equally significant.

Addition is an arithmetic operation. Bits have significance in this world. The state of the input bits have more "influence" over the left hand bits of the result than the right hand bits.

Look at abcd+efgh=ijkl (Ignoring any overflow'd bits per SHA-256.)

To find the value of bit l, you only need to know bits d and h. You need to know all eight input bits to know the value of bit i.

Re: Show HN: SHA-256 Animation

#46

I once heard about a meeting where someone did a presentation for the best part of an hour to a room full of Japanese people. They all nodded along, smiling as the presentation progressed. It wasn’t until the end that the presenter asked them what they thought. They all just kept smiling, but no answer. Someone at the front turned and talked to the room (in Japanese) then turned to the presented and said “they do not…

You need to watch his video, very cool, it really helps to understand how this works: https://www.youtube.com/watch?v=f9EbD6iY9zI

Re: Show HN: SHA-256 Animation

#47
This looks great, though it requires quite sometime to go through it (and figure out what could possibly be understood by someone with knowledge of programming and bit wise operators, and what can just be skipped because it’s something only cryptographers can understand).

If someone were to make a slower video explaining it with all the sections from this dissection, that’d be even more awesome.

Edit: Seems like the author created a video for this — https://www.youtube.com/watch?v=f9EbD6iY9zI (thanks to 1_player’s comment at https://news.ycombinator.com/item?id=23165906)

On a tangent, here’s an animation (by someone else) explaining AES encryption — https://m.youtube.com/watch?v=gP4PqVGudtg (thanks to harrigan’s comment at https://news.ycombinator.com/item?id=23165821)

Re: Show HN: SHA-256 Animation

#48

Here's the author doing an in-depth explanation of how SHA-256 works using this code: https://www.youtube.com/watch?v=f9EbD6iY9zI I'm halfway through, but looks very well done, thanks!

Wow, this was just what I asked for in a comment before seeing this comment. Thanks.

Re: Show HN: SHA-256 Animation

#49
post #36

Shameless plug: https://jrvidal.github.io/aes-demo/ I like this one better though.

Looks nice, but an explanation of each step would be more helpful to understand it (along with a coverage of the overall algorithm). The animation was a little too quick for me to follow along.

Re: Show HN: SHA-256 Animation

#50

I once heard about a meeting where someone did a presentation for the best part of an hour to a room full of Japanese people. They all nodded along, smiling as the presentation progressed. It wasn’t until the end that the presenter asked them what they thought. They all just kept smiling, but no answer. Someone at the front turned and talked to the room (in Japanese) then turned to the presented and said “they do not…

Did you see the README.md? It explains each of the steps.

Thanks for pointing that out - I kinda missed it until seeing your post. I went through each step - it's still a bit convoluted, but definitely helps me appreciate hashing functions. It's probably very easy for a poorly coded hash function to accidentally wipe important data or accidentally and a bunch of data with zeroes, so it's pretty cool to see a lot of ROT and XOR usage which does more interesting things with the original data.

Had no idea about the prime roots and multiplication, that's pretty clever too.

Post reply on HN