Discrete Logarithm

Discrete Logarithm

The discrete logarithm is a mathematical problem that is easy to pose but extremely hard to solve – and it is precisely this property that protects millions of encrypted connections on the internet today.

A logarithm answers the question: “To what power must I raise a base to obtain a certain result?” The discrete logarithm asks the same question, but within a special numerical world: one does not calculate with arbitrary numbers, but only with whole numbers within a fixed range – and at the end, the result is replaced by the remainder of a division, a procedure mathematicians call “calculating modulo n.” In this numerical world there is an astonishing property: exponentiation is easy and fast, but the reverse path – that is, the discrete logarithm – is, for large numbers, so hard that even the fastest computers in the world fail at it. This difference between “easy forward, hard backward” is no coincidence, but the foundation of an entire branch of modern encryption.

The Foundation of Modern Encryption

Secure communication on the internet requires a method by which two parties can agree on a secret key – even when third parties are listening in. This is only possible if there is a computational operation that is trivial in one direction and practically unsolvable in the other. The discrete logarithm fulfills exactly this condition.

The best-known procedure built on this is called Diffie-Hellman key exchange. Two parties publicly agree on starting parameters and then exchange computed intermediate values. Each side can derive the same secret key from this – an attacker who only sees the public values would have to solve the discrete logarithm to do the same. For realistic number sizes, such as 2048-bit numbers, this would, with today’s technology, take longer than the universe has existed.

Digital signatures – that is, the mathematical proof that a message truly originates from a specific person – are also based on the same principle. Without the discrete logarithm, a large part of the internet’s infrastructure would be unimaginable.

Why the Reverse Path Is So Difficult

A concrete example makes the difference tangible. Choose the base 3 and calculate modulo 17 – that is, always take the remainder after division by 17. A computer answers the question “What is 3 to the power of 5, modulo 17?” instantly: 3⁵ = 243, and 243 divided by 17 leaves a remainder of 5, so the result is 5. The reverse question, “3 to what power gives 5, modulo 17?” sounds just as simple – but it is not.

The problem lies in the fact that the results of calculating modulo n appear to be distributed seemingly at random across all possible remainders. There is no discernible pattern, no shortcut. For small numbers, one can simply try out all possibilities. But for cryptographically relevant numbers with hundreds of digits, there are more possible candidates than any computer could ever compute through.

There do exist algorithms that are smarter than simple brute-force trial – such as the so-called number field sieve. But even these methods scale poorly: if you double the length of the numbers used, the effort does not increase twofold, but exponentially. That is why it suffices simply to choose sufficiently large numbers.

Where the Term Appears in News and Products

Every time a browser establishes an HTTPS connection – recognizable by the lock symbol in the address bar – a procedure based on the discrete logarithm runs in the background. The same applies to encrypted messengers such as Signal or WhatsApp.

In technology news, the term appears above all in connection with quantum computers. A sufficiently powerful quantum computer could use the so-called Shor’s algorithm to efficiently solve the discrete logarithm – and thereby break all procedures built upon it. This is the main reason why governments and companies worldwide are working on “post-quantum cryptography”: new encryption methods that can withstand quantum attacks as well.

The discrete logarithm also plays a central role in blockchain technology. Bitcoin wallets use a variant called elliptic-curve cryptography, which transfers the principle to a different mathematical structure while getting by with significantly shorter keys – at the same level of security.

Subscribe free. Unsubscribe the second it sucks.

High-signal news across AI, business, UX, and tech. Every morning.