Understanding One-Way Functions in Cryptography

To understand what a one-way function in cryptography means, let's start by taking note of two important terms, namely private keys and public keys

The cryptographic private key is just a number. You can pick your private keys randomly using just a coin, pencil, and paper. Toss a coin 256 times, and you have the binary digits of a random private key you can use in a Bitcoin wallet. The public key can then be generated from the private key.

The first and most important step in generating keys is to find a secure source of entropy, or randomness. Creating a Bitcoin key is essentially the same as randomly “picking a number between 1 and 2^256."

The public key is calculated from the private key using elliptic curve multiplication, which is irreversible: K = k * G, where k is the private key, G is a constant point called the generator point, and K is the resulting public key

Anyone can use your public key to send you an encrypted message that only you can decrypt with your private key. This makes it very easy for everyone to send you secret messages.

So what is a one-way function? In layman’s terms, it’s a function that’s easy to compute one-way but very hard the other way.

Now let’s imagine I hand you two substantial numbers:

T = 437689 and U = 208764384.

Now, let's see the result when we multiply them together:

R = T × U = 91249608046376.

If you possess certain confidential details, reversing some mathematical functions becomes a breeze. In our case, if I whisper that one factor is 208764384, you can easily find the other: 91249608046376 ÷ 208764384 = 437689.

These math tricks are called trapdoor functions; they're tough to reverse, except when you hold a special secret key

Now if I gave you just R and asked you to find its 2 prime factors, you’d have a hard time. You would need to divide that big number by all the numbers and see which one works. That’s a lot of work!

But if I give you those two prime numbers, you can multiply them in 20 seconds.

The one-way function is used in cryptosystems like the RSA, an asymmetric encryption technique that uses two different but linked encryption keys (private and public).