News for hackers. Stuff that matters.
Re:Show HN: SHA-256 Animation by inersha on Wednesday May 13, 2020 @06:20AM (#23165375)
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, the Sigma functions promote diffusion of bits to help prevent collisions, and Choice/Majority/Addition help to make it a one-way function, but I'm not entirely sure. I'd be interested in learning more about the design if anyone has experience in this field.

Re:Show HN: SHA-256 Animation by stan_rogers on Wednesday May 13, 2020 @09:34AM (#23166713)
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

Re:Show HN: SHA-256 Animation by jmiserez on Wednesday May 13, 2020 @10:14AM (#23167071)
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 by mabbo on Wednesday May 13, 2020 @08:57AM (#23166407)
> I wanted to understand how SHA-256 works, so I...

... taught everyone else how SHA-256 worked...

This is an awesome intro. And now I also want to know more about the things you mentioned wanted to learn more about.

Re:Show HN: SHA-256 Animation by tialaramex on Wednesday May 13, 2020 @09:58AM (#23166918)
Without any doubt I do not properly understand anything I can't explain to someone else.

An exercise I go through constantly is figuring out how to explain a thing I think I know to a curious person with no relevant training. Often in the process I discover I need to go do more research or actually test things because I did not understand them as well as I'd maybe thought.

Mostly this is just an exercise. But every so often I actually get to use this in anger. A non-technical friend who works in a Computer Science department asked me on Facebook to explain a joke she'd seen which involved localhost addressing, and I was very pleased to be able to provide a concise explanation using analogies that I know hold up to scrutiny. Obviously a joke isn't very funny if you need it explained, and I can't fix that, but I can avoid the discomfort of her not understanding a joke other people are laughing at in her place of work.

Re:Show HN: SHA-256 Animation by bradjohnson on Wednesday May 13, 2020 @12:13PM (#23168405)
I realize it's not what you're saying, but I don't like the idea that if you can't teach something to others, you don't understand it yourself. Teaching is a skill and it's something that I am aware that I struggle with. I can explain something in great detail to a captive audience and understand it myself personally, but teaching is about getting others to engage with the ideas you're presenting and identifying and elaborating on parts that they don't understand.

Given the content of knowledge sharing sessions that I sit through and the convoluted nature of some of them, I wish that people recognized that presenting information is not all that is required to teach. You can understand something perfectly, but teach it horribly.

Re:Show HN: SHA-256 Animation by stevofolife on Wednesday May 13, 2020 @04:41PM (#23171594)
If you can't teach it, then you don't understand something perfectly. Perfect is a word par excellence. Teaching is indeed a skill but don't confuse it with presenting. A wise guy once said, "if you can’t explain something in simple terms, you don’t understand it". I'm sure OP stands by it and that itself is very admirable.
Re:Show HN: SHA-256 Animation by bradjohnson on Thursday May 14, 2020 @10:50AM (#23180223)
Feynman also said: "Hell, if I could explain it to the average person, it wouldn't have been worth the Nobel prize."

Ideas take time to digest and it's not accurate to say that if someone leaves a room not understanding what you've just shown them, you don't understand it yourself.

Re:Show HN: SHA-256 Animation by perl4ever on Thursday May 14, 2020 @09:29PM (#23187837)
It's possible that's a distortion/misquote. I found where he said "I would simply say, ‘Listen, buddy, if I could tell you in a minute what I did, it wouldn’t be worth the Nobel Prize", which is about time, not intellectual ability.

[https://www.aip.org/history-programs/niels-bohr-library/oral...]

Re:Show HN: SHA-256 Animation by tryauuum on Thursday May 14, 2020 @07:09PM (#23186736)
I guess previous posters "If you can't teach it, then you don't understand something perfectly" can be replaced with "Process of teaching someone will make you notice all the holes in your own understanding"

Or even without replacement. Teaching someone doesn't imply a successful result.

Re:Show HN: SHA-256 Animation by Zhyl on Wednesday May 13, 2020 @09:19AM (#23166600)
1) I loved this video.

2) I did have to take a sip of tea and think about my life when I realised I was watching a video by a Welshman about mining.

3) Although having said this, 'Welsh Bitcoin Miner' is going to fit seamlessly into my West Country themed cyberpunk adventure 'Cider Punk'.

Re:Show HN: SHA-256 Animation by mystickphoenix on Wednesday May 13, 2020 @11:15AM (#23167658)
You could call it CIDR Punk if you want to be a bit more on-the-nose ;)
Re:Show HN: SHA-256 Animation by inersha on Wednesday May 13, 2020 @09:31AM (#23166687)
1) Thank you.

2) It's certainly a combination I never anticipated.

3) I look forward to the book.

Re:Show HN: SHA-256 Animation by hinkley on Wednesday May 13, 2020 @02:21PM (#23169963)
I feel like this is some sort of James Watt reference but I can't be sure.
Re:Show HN: SHA-256 Animation by baicunko on Wednesday May 13, 2020 @06:28AM (#23165427)
This is a great idea of showing something that is at first very complex. Could be used in Discreet Mathematics to teach students!
Re:Show HN: SHA-256 Animation by m4r35n357 on Wednesday May 13, 2020 @07:41AM (#23165828)
Indiscreet mathematics?
Re:Show HN: SHA-256 Animation by perl4ever on Thursday May 14, 2020 @09:33PM (#23187859)
Somewhere I had the idea concrete math was a combination of continuous and discrete, but I seem to be mistaken.

"When DEK taught Concrete Mathematics at Stanford for the first time, he explained the somewhat strange title by saying that it was his attempt to teach a math course that was hard instead of soft. He announced that, contrary to the expectations of some of his colleagues, he was not going to teach the Theory of Aggregates, nor Stone's Embedding Theorem, nor even the Stone-Cech compactification. (Several students from the civil engineering department got up and quietly left the room.)"

Re:Show HN: SHA-256 Animation by ImJasonH on Wednesday May 13, 2020 @06:47AM (#23165556)
This is super impressive, thanks for building and sharing it!
Re:Show HN: SHA-256 Animation by lewiscollard on Wednesday May 13, 2020 @08:16AM (#23166058)
Nice work, and that is a very cool approach to learning new things!
Re:Show HN: SHA-256 Animation by w0utert on Wednesday May 13, 2020 @07:39AM (#23165818)
Like it a lot. Not sure how useful it is but just looking at it is mesmerizing, well done!
Re:Show HN: SHA-256 Animation by jonathanzufi on Thursday May 14, 2020 @02:38PM (#23183544)
This is fantastic - and your YouTube video is also impressive. Thank you for doing this.
Re:Show HN: SHA-256 Animation by inersha on Thursday May 14, 2020 @03:08PM (#23183958)
No problem at all, thank you.
Re:Show HN: SHA-256 Animation by imoverclocked on Wednesday May 13, 2020 @11:36AM (#23167926)
Congratulations on the worlds slowest and useful SHA-256 implementation! :)
Re:Show HN: SHA-256 Animation by nayuki on Wednesday May 13, 2020 @11:40AM (#23167986)