These functions are one-way in that they are easy to compute in one direction, and very hard to compute in the other direction. Elliptic curves are nice, but here's an simpler-to-understand one-way function: Consider 3^x mod 7
. Raise 3 to some value, divide by 7 and take the remainder.
Given x, compute the result. This is easy to work forward. You can do it by hand. Try it out for x=5. Even for very large numbers, this is very efficient to compute. The difficulty goes up roughly with the log of the values. (Think about how much harder multiplying 4-digit numbers is than multiplying 3-digit numbers by hand. It's only a little harder and slower, even though the values are ten times larger.)
Now try to do the opposite (this is called the discrete log). If I tell you that the remainder is 5, tell me what x is. This is a much harder problem. In fact, you pretty much have to compute the value for each value of x and try to find one that matches. This is a linear search over the space. Now there are only 7 elements in this space, so that's not so hard. But what if the modulo were much larger? Much, much larger. Every time I add one bit to the size of the modulo, I double your search space.
Most cryptography systems include something like this at their heart. There are a lot of different approaches, and elliptic curves are just one, but they all try to create a one-way function; a function that is easy to compute in one direction and hard to compute in the other.
But what if there is an easy way to compute it in the other direction? Maybe we just haven't figured it out yet. We haven't been able to prove that these problems are hard. There is an open question, in fact, whether these particular kinds of one-way functions even exist. We believe they do, and the discrete log problem seems to be one of them. This is called the P=NP problem. If someone proved P=NP, then most of our cryptographic approaches would be attackable (at least in theory; proving something can be attacked doesn't tell you how). But we're pretty sure that P does not equal NP, and as a practical matter, these functions are currently very hard to attack.
n
... operations". No, this is incorrect. The algorithm to compute the public key fromn
andG
is equivalent to addingG
to itselfn
times, but it only takes about log n steps. – President James K. Polk Jul 26 '18 at 13:17