One-Way and Trapdoor Functions: The Heart Of Modern Encryption
Introduction
By definition, a one-way function is easy to compute but hard to invert. In other words, inverting a one-way function is equivalent to solving an intractable mathematical problem for which no computationally efficient algorithm is known. One-way functions represent the foundation of modern asymmetric (or public-key) cryptography. Indeed, most asymmetric cryptographic techniques base their security on the hardness of inverting these functions. However, this hardness is only assumed, since from a theoretical point of view it is still an open problem. A formal proof of the existence of one-way functions would have major implications in computational complexity theory and is closely related to one of the seven Millennium problems, namely the P vs NP problem. These problems were selected by the Clay Mathematics Institute in 2000 and consist of seven unsolved mathematical problems whose solutions would have a crucial impact on both theory and applications. A one million dollar prize has been offered for the solution of each problem. Among them, it is worth mentioning the Riemann Hypothesis, whose solution would have important consequences for the distribution of prime numbers and therefore for number theory and cryptanalysis. The only Millennium problem solved so far is the Poincaré conjecture; the others remain open. The fact that the existence of one-way functions is still conjectured means that none of them has been proven to be hard to invert. In theory, it is therefore possible that an efficient algorithm could be discovered in the future, breaking the hardness assumption and, with it, the security of many cryptographic schemes. Despite this lack of mathematical proof, the scientific community strongly believes that such a breakthrough is unlikely. This belief is motivated by the fact that many candidate one-way functions have withstood decades of cryptanalysis. Examples include cryptographic hash functions, integer multiplication of large primes, and modular exponentiation. In particular, the inversion problems associated with the last two — known as integer factorization and the discrete logarithm problem — form the basis of most cryptographic schemes currently in use, such as RSA and Diffie–Hellman.
One-way functions in public key cryptography
To build an intuition, a one-way function can be compared to a blender: starting from the input, it is easy to obtain the mixed output, while reconstructing the original input from the output is essentially impossible. More formally, let
be a function. The function
is called one-way if:
- given
, it is easy to compute
; - given
, it is computationally hard to find
such that
.
Looking at modern public key cryptography, a typical example is provided by the modular exponentiation used in the Diffie-Hellman key exchange. Given a prime number
and a positive integer
less than
, the following function is a one-way function candidate:
![]()
Observe that computing the
-th power modulo
is easy. On the other hand, given a positive integer
less than
, finding the element
such that
is an intractable problem. This problem is known as the discrete logarithm problem and forms the basis of many cryptographic schemes such as the Diffie-Hellman key exchange and the Elliptic Curve Digital Signature Algorithm (ECDSA). To better understand its role in public key cryptography, it is useful to discuss how the one-way function concept is related to the public–private key pair of a public key algorithm. Typically, given a one-way function
, the public–private key pair can be defined as
, where
is a randomly chosen element. In the case of Diffie-Hellman, the secrecy of the private key
is based on the difficulty of inverting the function
.
Trapdoor functions in public key cryptography
A special case of one-way functions is represented by trapdoor functions. These functions have the property of being easy to invert when additional secret information (the trapdoor) is known, while they behave as normal one-way functions otherwise. A trapdoor function can be compared to the closing mechanism of a lock: anyone is able to lock it, but only those who own the key (the trapdoor) can easily open it. Formally, a trapdoor function is a one-way function with the property that, if a secret information
is known, then there exists an efficient function
such that, given any
,
. A famous example of a trapdoor function is the one on which the RSA cryptographic scheme is based. Let
and
be two prime numbers and let
be their product. Let
and
be two positive integers coprime with
such that
![]()
The public key is given by
, while the private key is
. The one-way function is
![]()
Also in this case, computing
starting from
is easy, while finding an
-th root modulo
of an integer
is assumed to be hard. The function
is a trapdoor one-way function, where the trapdoor consists in the knowledge of the private key
. Indeed, consider the function
![]()
since
, it follows that, for any
,
, and therefore
![]()
In other words,
is exactly the original message
.
One-way vs trapdoor
The main difference between one-way functions with and without a trapdoor is the presence of secret information that allows efficient inversion. This implies the existence of a hidden structure that could potentially leak some information about the secret key. Therefore, in the analysis of these schemes, it is crucial to address both the difficulty of inversion and the security of the trapdoor. In RSA, the inversion of
consists of computing an
-th root modulo N, and the trapdoor security is based on the hardness of factoring
in order to obtain
. In asymmetric cryptography, trapdoor functions are used to hide the message, allowing it to be recovered only by those who know the trapdoor. On the other hand, a simple one-way function is typically used to generate a public–private key pair. As already mentioned in previous articles, thanks to Shor’s Algorithm, a quantum computer is able to efficiently invert both prime multiplication and modular exponentiation, affecting the security of most asymmetric schemes currently in use. Therefore, it is crucial to study and analyze quantum-resistant one-way functions. Post-Quantum Cryptography is a response to the quantum computing threat, identifying new mathematical problems and therefore new one-way functions that are believed to be resistant even in the presence of quantum algorithms. In the next articles of this series, some examples of these constructions will be discussed in a post-quantum setting.
This article belongs to a series of contributions, edited by the Telsy Cryptography Research Group, devoted to quantum computing and its implications on Cryptography. For reference to other articles, please refer to the index.
For other articles related to Quantum and Cryptography topics, please refer to the related categories in the blog.
The authors
Veronica Cristiano, a bachelor’s degree in Mathematics from the University of Pisa and a master’s degree in Mathematics with a specialization in Cryptography at the University of Trento, joined the Telsy Cryptography research group in mid-2021.
Giuseppe D’Alconzo, graduated in Mathematics with a specialization in Cryptography at the University of Trento, in 2019 he carried out an internship at Telsy, dealing with Multiparty Computation and Attribute-Based Encryption. He is currently a PhD student in Pure and Applied Mathematics at the Politecnico di Torino, with a “Post-Quantum Cryptography” scholarship within the UniversiTIM program and in collaboration with the Telsy Research Group.