by manceraio on 2/7/22, 1:31 PM with 137 comments
by oconnor663 on 2/7/22, 4:33 PM
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 :)
by picture on 2/7/22, 4:33 PM
by taviso on 2/7/22, 3:26 PM
https://lock.cmpxchg8b.com/sha1/visualize.html
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!
by mabbo on 2/7/22, 2:38 PM
After watching this: "How can any cryptographer EVER figured out any trick to crack these hash algorithms?!"
by userbinator on 2/7/22, 2:38 PM
by nayuki on 2/7/22, 3:08 PM
Also relevant: https://www.righto.com/2014/09/mining-bitcoin-with-pencil-an...
by y42 on 2/7/22, 6:09 PM
https://nickyreinert.medium.com/wie-funktioniert-der-sha256-...
by p1mrx on 2/7/22, 4:27 PM
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.
by ypcx on 2/7/22, 4:27 PM
by spdebbarma on 2/7/22, 5:51 PM
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.
by brk on 2/7/22, 3:14 PM
by DJPocari on 2/7/22, 2:55 PM
by westurner on 2/7/22, 3:05 PM
https://rosettacode.org/wiki/SHA-256
Hashcat's GPU-optimized OpenCL implementation: https://github.com/hashcat/hashcat/blob/master/OpenCL/inc_ha...
Bitcoin's CPU-optimized sha256.cpp, sha256_avx2.cpp, sha256_sse4.cpp, sha256_sse41.cpp: https://github.com/bitcoin/bitcoin/blob/master/src/crypto/sh...
https://github.com/topics/sha256 https://github.com/topics/sha-256
Cryptographic_hash_function#Cryptographic_hash_algorithms: https://en.wikipedia.org/wiki/Cryptographic_hash_function#Cr...
Merkle–Damgård construction: https://en.m.wikipedia.org/wiki/Merkle%E2%80%93Damg%C3%A5rd_...
(... https://rosettacode.org/wiki/SHA-256_Merkle_tree ... Merkleized IAVL+ tree that is balanced with rotations in order to optimize lookup,: https://github.com/cosmos/iavl
Self-balancing binary search tree: https://en.wikipedia.org/wiki/Self-balancing_binary_search_t... )
by daenz on 2/7/22, 4:22 PM
by chris_l on 2/7/22, 3:35 PM
by jonathanyc on 2/7/22, 5:15 PM
by bmitc on 2/7/22, 8:20 PM
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.
by anonymousDan on 2/8/22, 7:00 AM
by a-dub on 2/8/22, 1:44 AM
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.
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.
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?)...
by Darkphibre on 2/7/22, 5:24 PM
by recursive on 2/7/22, 9:41 PM
by seumars on 2/7/22, 2:32 PM
by ansible on 2/7/22, 11:14 PM
by abrookewood on 2/8/22, 1:58 AM
by fthtls on 2/8/22, 9:48 AM
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.
btw, the decrypter i coded -> https://10015.io/tools/sha256-encrypt-decrypt
by based2 on 2/7/22, 7:53 PM
by anandsuresh on 2/8/22, 1:49 AM
Just sent you a PR for some typos I found while running through an example.
by M4tze on 2/7/22, 2:50 PM
by stevofolife on 2/7/22, 5:43 PM
by sylware on 2/7/22, 8:56 PM
by reincarnate0x14 on 2/7/22, 4:33 PM
by nwatab on 2/7/22, 1:47 PM
by dicroce on 2/8/22, 2:19 PM
by hombre_fatal on 2/7/22, 7:30 PM
by berta on 2/7/22, 5:11 PM
by iqanq on 2/7/22, 3:41 PM
by jerpint on 2/7/22, 3:42 PM