Live data from Hacker News

Show HN: SHA-256 explained step-by-step visually

sha256algorithm.com

31–40 of 145 posts

Re: Show HN: SHA-256 explained step-by-step visually

#33
post #31

Can it be proven whether values of m exist such that SHA256(m) == 0? If I were omnipotent and wanted people to believe in me, I would write a book that hashes to 0, so that anyone could verify its authenticity.

You could in theory also get that with a lot of computation of course

Re: Show HN: SHA-256 explained step-by-step visually

#34

Earlier quoted context omitted.

If such a movie even mentions SHA-256 I think that's above average on its own.

That depends.. "Just a second, I need to backdoor the SHA256 rootkit to penetrate the directory. Shit, they have an X62 firewall. Luckily I brought my pentester."

"These packets are not going to sniff themselves."

Re: Show HN: SHA-256 explained step-by-step visually

#35
Oh this is great. When we taught SHA-256 last semester, we linked to this YouTube video: https://youtu.be/f9EbD6iY9zI. Next time we do it, we'll probably link to both. Having several different ways to visualize the same thing is very helpful, and I like that this one moves quickly.

A couple of details missing from this visualization are how you pad a message to be a multiple of the block size, and how you chain blocks together to form a longer message. In the pseudocode at https://en.wikipedia.org/wiki/SHA-2#Pseudocode, that's the "Pre-processing (Padding)" part and the "for each chunk" loop just below it. I get why you'd want to leave those things out, since they're not really the interesting part, and the screen is already pretty packed as it is.

If anyone's feeling curious about implementing this yourself, take a look at these project notes: https://github.com/oconnor663/applied_crypto_2021_fall/tree/.... At some point I'll clean that up for public consumption, but for now just ignore the parts about grades and cheating :)

Re: Show HN: SHA-256 explained step-by-step visually

#36
So, how do people come up with these things? I assume every aspect of the design is carefully considered to defend it against various attacks. For example, why "right rotate 7 XOR right rotate 18 XOR right shift 3" and not "right rotate 2 XOR right rotate 3 XOR right shift 4"?

Re: Show HN: SHA-256 explained step-by-step visually

#38
post #33
post #31

Can it be proven whether values of m exist such that SHA256(m) == 0? If I were omnipotent and wanted people to believe in me, I would write a book that hashes to 0, so that anyone could verify its authenticity.

You could in theory also get that with a lot of computation of course

It should be straightforward to design a hash function that can't be preimage attacked using all the computing power in the universe.

Maybe an omnipotent cryptographer would find flaws in SHA-256, but then they could design a better function and include it in the book.

Re: Show HN: SHA-256 explained step-by-step visually

#39
post #36

So, how do people come up with these things? I assume every aspect of the design is carefully considered to defend it against various attacks. For example, why "right rotate 7 XOR right rotate 18 XOR right shift 3" and not "right rotate 2 XOR right rotate 3 XOR right shift 4"?

Visualized like this it feels like security through obscurity, but there must be reason for this.

I did wonder why initialization is like:

1. Initialize hash value h0 to h7: first 32 bits of the fractional parts of the square roots of the first 8 primes 2..19).

2. Initialize array of K constants: first 32 bits of the fractional parts of the cube roots of the first 64 primes 2..311

Re: Show HN: SHA-256 explained step-by-step visually

#40

Oh this is great. When we taught SHA-256 last semester, we linked to this YouTube video: https://youtu.be/f9EbD6iY9zI . Next time we do it, we'll probably link to both. Having several different ways to visualize the same thing is very helpful, and I like that this one moves quickly. A couple of details missing from this visualization are how you pad a message to be a multiple of the block size, and how you chain bloc…

Thanks for the feedback and I am glad you'll use it for teaching (which was the main goal of this project)! The padding part it's briefly explained on the "dynamic" notes on the left column, but yes, can be improved. Typing on the input gives you some sense of what is doing on the background, specially if it jumps to two blocks.

The "for each chunk" is also implemented (which was one of the most difficult parts to synchronize with the UI), but I agree too, I should come up with some way to represent it better. Thanks again :)

Post reply on HN