Live data from Hacker News

Why are neural networks and cryptographic ciphers so similar? (2025)

reiner.org

51–55 of 55 posts

Re: Why are neural networks and cryptographic ciphers so similar? (2025)

#51
post #3

Can anyone recommend any good content to learn cryptography? Like, even if I read the algorithm for AES I have zero understanding about why it works this way I've finished the Cryptography I on Coursera already. Can't recommend it enough

https://mit6875.github.io/ - MIT's Foundations of Cryptography is publicly available with full lectures, lecture note pdfs, and 5 problem sets. It's very rigorous and proof-driven which can be hard at times, but the professor's enthusiasm for the subject is infectious and makes the lectures a pleasure to watch.

Re: Why are neural networks and cryptographic ciphers so similar? (2025)

#52
post #46

Earlier quoted context omitted.

Hmm, I've studied a lot of math, and I disagree. Cryptography is mostly number theory, which always looks simple on the surface, and often only needs "elementary" tools, but I still find it much harder than other areas of math. For example, the proof that there are infinitely many primes looks simple [0], but it's still pretty hard to understand, let alone derive yourself independently. And the other important crypto…

yes, deriving all of the math cryptography depends on independently would not be easy. Fortunately, that's not really how anybody learns. Along those lines, you do not need to understand the proof of Euler's totient theorem to understand cryptography. It is a distraction. All you need (at most) is to know that the result is true, and even then it's only fundamentally important for RSA, which you likely shouldn't both…

> Along those lines, you do not need to understand the proof of Euler's totient theorem to understand cryptography.

Well, I had to when I learned cryptography, but I learned it from a class offered by the math department, so I guess that's rather unsurprising :).

> even then it's only fundamentally important for RSA […] this is not a good combination of properties

Strong agree here.

Re: Why are neural networks and cryptographic ciphers so similar? (2025)

#53
post #12

Because both of them are optimized for hardware. Neural networks, despite the name, have very little similarity to biologics. There's a lot of multiplication of numbers in parallel, so it makes sense to try to fit that to matrices. Cryptography is built bottom-up, but likewise it makes sense to exploit data structures that already exist in silicon.

More simply, most interesting operations will involve "mixing up" of data. There's only so much you can do by applying a bunch of operations in series with a single input value.

Re: Why are neural networks and cryptographic ciphers so similar? (2025)

#55
Related articles; re: rounds and layers:

- "Why are neural networks and cryptographic ciphers so similar? (2025)" https://reiner.org/neural-net-ciphers .. https://news.ycombinator.com/item?id=47983467

- "Show HN: ResonanceNet – Proof-of-Training Blockchain" https://news.ycombinator.com/item?id=47386901

- "Cryptographic hashing as a transformer attention head" https://github.com/ffr1/unbounded-context-attention

- 'Implementation for NDSS'2025 paper: "TensorCrypt: Repurposing Neural Networks for Efficient Cryptographic Computation"' https://github.com/OSUSecLab/TensorCrypt :

> More specifically, with a program translation framework that converts traditional cryptographic algorithms into NN models, our proof-of-concept implementations in TensorFlow demonstrate substantial performance improvements: encryption speeds for AES, Chacha20, and Salsa20 show increases of up to 4.09×, 5.44×, and 5.06×, respectively, compared to existing GPU-based cryptographic solutions written by human experts.

Post reply on HN