I’m not a cryptographer so I’m probably gonna butcher this, but hey it’s reddit, let’s go.
what you want for public key cryptography are two related numbers, a private one which can be chosen at random, and a public one that can be easily derived from the private one. however, it must be near impossible to derive the private number from the public number, otherwise it’s all pointless.
the idea is that you can give your public number to anyone, and they can use it as a key to encrypt some data to send to you. the data can only be decrypted using your private number as a key, which you never give out.
how these two numbers are related is critical. what you’re looking for are elliptic curves (not elliptical). these curves are graphed, like a line graph. between a certain range, you can choose an x value and read off a positive or negative y value. this will make much more sense if you google a diagram.
the nice property for some of these curves, is that if you choose an arbitrary x value, and get the slope of the line at that x value, you can extend that slope and it points to one other location on the curve. it’s very hard to go backwards, there’s no formula, you basically have to search “could this x location have pointed here”.
it’s not *too* difficult, however, so what you do is you choose your x value, find the slope, find the intersection of her slope with the line, then *invert* the y value, find the slope at that point, find where that slope intersects with the line again and so on. doing that a few thousand times is very very fast with a computer. however, if you do enough iterations, going back that other way would take billions of years even if you used all the computers in the world.
there’s other obfuscations they employ too, such a chopping the curve up into tiny segments and rearranging them, etc.
what you end up with, is your first x value, which you chose pretty much at random, and your final x’ value, which is derived from x, but you can’t go from x’ to get x.
then they use some maths that’s beyond me to combine those values into a multiplication that you apply to your data to do the encryption, such that anyone can encrypt data with x’, but only x can be used to decrypt it.
Latest Answers