• gouggoug 18 hours ago

    This article explains, poorly, _what_ public key cryptography is but not _how_ public key cryptography really works, at all.

    Saying that Natasha and Boris both choose a prime number and then "create a safe" with it, is the same as telling someone that to make cake Alice and Bob went to the store and bought flour and eggs.

    If you want a real, good and visual explanation of _how_ it works, with simple maths, go watch Computerphile's video[0] about Diffie-Hellman.

    [0]: https://www.youtube.com/watch?v=NmM9HA2MQGI

    • x3y1 15 hours ago

      I really liked the book “Implementing SSL / TLS Using Cryptography and PKI”. When trying to understand certificates and TLS, there always seemed to be some tricky bits that most explanations glossed over. In this book, the author builds a working TLS implementation in C, which means they have to cover all the details.

    • loloquwowndueo 18 hours ago

      I was expecting a real example using some actual numbers and simple operations to demonstrate how this works. Instead there are a couple of vague metaphors that don’t explain much about the actual math involved beyond “multiply two primes”.

      • Jtsummers 18 hours ago

        https://www.cs.utexas.edu/~mitra/honors/soln.html

        Worked example using p = 3 and q = 11.

        φ(n) is the most complex part, but you can take it as shown if you don't care about the proof. For two primes, φ(p * q) = (p - 1) * (q - 1). The proof of this is more complex, and the calculation can get more involved if it's not a pair of primes, but for RSA it's that simple.

        Coprime can be defined using middle/high school math: two numbers are coprime if gcd(n,m) = 1. They have no common factors other than 1, that's all it means. So 4 and 9 are coprime even though neither are prime.

        ----

        φ(n) is Euler's totient function. It gives you the number of numbers coprime to n in the range 1 <= k <= n. So in the worked example, φ(n) = 20 means there are 20 numbers in that range that have no factors other than 1 in common with 33:

           1  2  4  5  7
           8 10 13 14 16
          17 19 20 23 25
          26 28 29 31 32
        
        None of those have 3 or 11 as factors.

        https://en.wikipedia.org/wiki/Euler's_totient_function

        • d-lisp 18 hours ago

          Would you be interested in that ? I could write about it

          • abridges6523 10 hours ago

            If you write about it, I’ll read it

        • avazhi 13 hours ago

          As usual with Quanta, the actual article didn’t explain anything well and was a waste of time (which is funny because Quanta is usually off the deep end with pages of esoteric babble that is gibberish except to genuine specialists. In this case, not only was there no ‘simple math’ - there was no math!). I’ve really got to stop clicking on Quanta links.

          For an actually well written and deeply informative ‘how it works’ for public key cryptography, see:

          https://www.bloomberg.com/features/2022-the-crypto-story/?em...

          • joshfraser 14 hours ago

            The original RSA paper is only 7 pages long and is worth reading.

            https://dl.acm.org/doi/pdf/10.1145/359340.359342

            • miketery 18 hours ago

              I don't think the link is a great resource. However this is the best elliptic curve cryptography resource that I've found to date. Would love to see something similar for ZKs.

              https://curves.xargs.org/

            • malkia 18 hours ago
              • duxup 18 hours ago

                I was hoping for simple math. None found.

                • d-lisp 18 hours ago

                  Would you be interestedin that ? I could write about it.

                  • ncruces 10 hours ago

                    Some time ago I tried to come up with something that worked with pen and pencil, even if it used backup tables or something, to make a board game that would explain the concept to kids.

                    I wasn't very successful, and eventually gave up. It's hard to come with something simple that's easy to do in one direction, but moderately hard to do in the opposite across some skill levels.

                    Which, eventually makes the concept unintuitive, when explained through the lens or “simple, primary school math” (which is all most grown ups can deal with, without immediately reaching out for a phone/calculator).

                    So, the intuitive explanation that does work (for RSA) is the “I send you an open safe only I have the key for, you fill it, and you close it and send it to me.” That's instantly intuitive, and works. The rest… meh.

                • mmcnl 9 hours ago

                  Public key cryptography (and specifically the Diffie-Hellman key exchange) is arguably the greatest mathematical discovery of the 20th century. I guess digital trust wouldn't exist without it.

                  • vrighter 13 hours ago

                    This describes rsa. Which you should not be using anymore. It's slow and has huge keys. The current reccommendation is to use ed25519, which doesn't work quite like this.

                    • Asraelite 12 hours ago

                      If you're really serious about security then elliptic curves are kind of already obsolete as well. We should be using post-quantum algorithms today, and I'm surprised more people aren't concerned about that.

                      Quanta also has an article about how lattice-based cryptography works: https://www.quantamagazine.org/cryptographys-future-will-be-...

                      • upofadown 10 hours ago

                        My understanding is that RSA is fast for signature verification and encryption but is slow for signature creation, decryption and keypair creation. So it might depend on the application.

                      • efilife 18 hours ago

                        In my opinion, the "safe", "magic ink" and such terminologies only make it harder to grasp. I would prefer if the actual terms were used

                        • namaria 10 hours ago

                          Yes, the bane of the self learners. Explanations often omit "you don't need to know this" bits because it's crystal clear to the explainer but you're left with big gaps in the shape of black boxes in your understanding.

                          Until you can piece it together from other explanations that omitted different bits.

                        • undefined 7 hours ago
                          [deleted]