Oh this is great. When we taught SHA-256 last semester, we linked to this YouTube video: <a href="https://youtu.be/f9EbD6iY9zI" rel="nofollow">https://youtu.be/f9EbD6iY9zI</a>. 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.<p>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 <a href="https://en.wikipedia.org/wiki/SHA-2#Pseudocode" rel="nofollow">https://en.wikipedia.org/wiki/SHA-2#Pseudocode</a>, 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.<p>If anyone's feeling curious about implementing this yourself, take a look at these project notes: <a href="https://github.com/oconnor663/applied_crypto_2021_fall/tree/main/sha256" rel="nofollow">https://github.com/oconnor663/applied_crypto_2021_fall/tree/...</a>. At some point I'll clean that up for public consumption, but for now just ignore the parts about grades and cheating :)
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"?
That's really cool. I made a terrible one for SHA1 years ago, yours is 1000x better.<p><a href="https://lock.cmpxchg8b.com/sha1/visualize.html" rel="nofollow">https://lock.cmpxchg8b.com/sha1/visualize.html</a><p>I read a paper at the time where someone described a tool they made to find a near-collision, they explained they were just flipping bits and visually observing the affects. That sounded kinda fun, but they didn't release it, so I tried to replicate it from their description!
Before watching this: "Why can't cryptographers just figure out some tricks to crack these hash algorithms?"<p>After watching this: "How can any cryptographer EVER figured out any trick to crack these hash algorithms?!"
This reminds me that I've always wanted to make a huge interactive combinatorial circuit that computes SHA-256 and shows all its internal state, then put it on a site with the claim that anyone who can make its output match a certain clearly-constructed value (e.g. 0123456...ABCD...) will win a prize. No mentions of hash algorithms or other such phrasing to deter anyone. I wonder how many people would try such a "logic puzzle", how much time they'd spend on it, and if we might even get the first successful preimage attack from that.
My way of explaining step by step visually is by implementing in Excel: AES <a href="https://www.nayuki.io/page/aes-cipher-internals-in-excel" rel="nofollow">https://www.nayuki.io/page/aes-cipher-internals-in-excel</a> ; DES <a href="https://www.nayuki.io/page/des-cipher-internals-in-excel" rel="nofollow">https://www.nayuki.io/page/des-cipher-internals-in-excel</a> .<p>Also relevant: <a href="https://www.righto.com/2014/09/mining-bitcoin-with-pencil-and-paper.html" rel="nofollow">https://www.righto.com/2014/09/mining-bitcoin-with-pencil-an...</a>
There also exists a written description showing the process in Python, step by step, which I consider more helpful, because you do not need to stop and play the video.<p><a href="https://nickyreinert.medium.com/wie-funktioniert-der-sha256-algorithmus-im-detail-teil-1-2-7a0023cf562a" rel="nofollow">https://nickyreinert.medium.com/wie-funktioniert-der-sha256-...</a>
Can it be proven whether values of m exist such that SHA256(m) == 0?<p>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.
Similar project which visualizes SHA-256 into terminal: <a href="https://github.com/in3rsha/sha256-animation" rel="nofollow">https://github.com/in3rsha/sha256-animation</a>
This comes to my attention at a really convenient time. As a teenager, I initially got interested in Computer Science due to cryptography. Over a decade later, I've gotten into the subject for the first time since then.<p>For the last few days, I've been writing my own encryption for fun even though it's 100% not secure enough or powerful. My belief is that even though it's not super useful, the experience of attempting to write one is teaching me a lot more than I would have by simply studying it.
How long before we see this website as the source for some "hacker sequence" in a movie where a person wearing a black hoodie states they are "... working on cracking their SHA-256 encryption, should only take a sec."
This is fantastic. I once implemented SHA-256 in Google Sheets to visualize it, but it had horrible performance compared to this. This is the best visualization I've seen yet.
I love single-purpose websites like this that put a potentially complex implementation behind an elegantly simple interface. This website’s design and styling are pretty too :) Another useful one is <a href="https://www.h-schmidt.net/FloatConverter/IEEE754.html" rel="nofollow">https://www.h-schmidt.net/FloatConverter/IEEE754.html</a> . I’d say even <a href="https://godbolt.org/" rel="nofollow">https://godbolt.org/</a> counts!
Does anyone have any good references, preferably a book but a good detailed website is fine, on cryptography, hashing, public/private keys, tokens, encryption, etc. as it relates to a software engineer? I don't necessarily want to know all the nitty gritty details of how these things are implemented. Rather, I think I would prefer simply understanding them and how to use them, piece them together, etc. to build something out of them.<p>I just have very little knowledge in this area. I'm going through a how to build a blockchain book right now, and I find myself struggling a little bit where I'm just calling some library functions but not necessarily knowing how to compose things properly.
I have an odd request regarding e.g. SHA-3. Can anyone tell me if it is implemented in a way that is in a sense 'one-pass' over its input, i.e. each byte of its input in memory is accessed only once, after which all of the algorithm state is held in registers and the original input is never accessed again? My scenario is one where I'm concerned about TOCTOU-like attacks on the memory where the input is stored, but I don't want to pay the overhead of first copying the whole input to a 'safe' memory location, e.g. imagine I have kernel code wanting to compute a hash over data stored in userspace.
this is funny. when i first learned the algorithm, i found some matlab code that computes it with bit vectors. i added support for displaying them as an image and used the movie feature to generate step by step movies to build intuition.<p>nice to see someone build something polished that visualizes it in the same way. once you look at the mechanics for each round of the compression function and see the bits get swirled around for yourself, it starts to make intuitive sense.<p>the other big intuitions are of course, the trapdoor nature of add mod 2^32 (which is implicit in unsigned integer overflow on many machines) and the fact that some operations (like xor) operate in galois field 2, while others (like addition) operate in galois field 32 and the repeated stacking of the operations in different fields gives the function it's nonlinear trapdoor property.<p>i remember reading a pretty good paper on the arx (add, rotate, xor) family of ciphers back in the day (sort of in the vein of, is that all you need?)...
Man, this is amazing. I had to hand-unroll bit packing in a binary encoding scheme we used in a game. Rare enough that making a tool wasn't worth it, but damn I love your visualizations! Doing something like that would have helped others understand how I was "seeing the matrix."
On the third step(?) of the second step, it says "Copy 2nd chunk into 1st 16 words", but it's accompanied by a visualization of copying the <i>1st</i> chunk into the 1st 16 words. Am I just totally misunderstanding something?
Is there a library or application that can take an annotated algorithm, and then generate a website like this one? That would be great for beginning CS and the sorting algorithms and other basic data structures too.
great visualization. i've also checked the source code and utility functions. they are very well defined and useful too.<p>i've coded a sha256 decrypter recently which uses dictionary attack and brute force. I read lots of articles about sha256 while coding this tool. there were still some missing parts on my mind, but your project clarified all.<p>btw, the decrypter i coded -> <a href="https://10015.io/tools/sha256-encrypt-decrypt" rel="nofollow">https://10015.io/tools/sha256-encrypt-decrypt</a>
Pretty cool. Have been looking for something like this for a while. Thanks for building it.<p>Just sent you a PR for some typos I found while running through an example.