We will delve a little more into the details of PRGs, PRFs and PRPs (Pseudorandom Permutations).
-
PRG (Pseudorandom Generator): This is a deterministic algorithm that takes a short random seed as input and outputs a much longer pseudorandom bit string. The PRG is represented by the node
prg
. -
PRF (Pseudorandom Function): This is a family of functions that appear indistinguishable from truly random functions. In other words, given a fixed key, the PRF behaves like a random function. The PRF is represented by the node
prf
. -
PRP (Pseudorandom Permutation): This is a type of PRF that is also a permutation, meaning that for every key, the function is bijective (one-to-one and onto), and there exists an inverse function. The PRP is represented by the node
prp
.
The arrows in the diagram represent the relationships between these cryptographic primitives:
-
The PRG can be used to generate random keys or random seeds for the PRF and PRP. It can also expand a short random seed into a longer pseudorandom string to be used as the key for the PRF and PRP.
-
The PRF can take a random key generated by the PRG and produce a pseudorandom output that appears as if it were generated by a truly random function.
-
The PRP is a special case of the PRF, where the functions are also permutations. This means that the PRP can be used to securely encrypt data in a way that provides confidentiality and integrity, as well as support decryption with the appropriate key.
Blum-Micali PRG
-
Setup:
- Select two large distinct prime numbers and , such that . These primes satisfy certain properties that make the algorithm secure.
- Compute the modulus .
-
Key Generation:
- Select a random integer between 1 and as the initial seed.
-
Pseudorandom Bit Generation:
- To generate each pseudorandom bit, repeat the following steps:
- Compute the next seed as .
- Extract the least significant bit (LSB) of and output it as the pseudorandom bit.
- To generate each pseudorandom bit, repeat the following steps:
The resulting output sequence of bits forms the pseudorandom bitstream. The Blum-Micali PRG has the property that the pseudorandom bits are computationally indistinguishable from true random bits, assuming the quadratic residuosity problem is hard.
The security of the Blum-Micali PRG relies on the hardness of the quadratic residuosity problem, which states that given a large composite number n, finding a square root modulo is computationally difficult unless you know certain factors of . In the context of Blum-Micali, the composite number is the product of two large distinct primes and . Saves us from fast correlation attacks too, pretty neat!
However, there are some considerations when using the Blum-Micali PRG. It is relatively slow compared to other modern PRGs, making it less suitable for applications that require high-speed generation of pseudorandom bits. Additionally, the security of the Blum-Micali PRG can be affected if the prime factors and are not selected correctly or if the generator is not used properly. In most modern libraries, construction of the Blum-Micali PRG is almost never used raw. The seed selection also needs to be done carefully. An interesting read for you here (opens in a new tab) on benchmarking of default compiler PRGs.
The Goldreich-Goldwasser-Micali (GGM) construction
Let's extend this idea of using hard reverse computability as I like to call it to construct a PRF. The Goldreich-Goldwasser-Micali (GGM) construction is a cryptographic pseudorandom function (PRF) that transforms a one-way function into a PRF. The basic idea is to use the hardness of inverting a one-way function to create a function that behaves like a random function, even though it is efficiently computable. The construction is based on a family of one-way functions and a seed value to derive pseudorandom outputs.
Let's define the GGM construction formally:
-
Let be a one-way function. It takes two inputs, a key and a string , and returns an output denoted as .
-
Choose a pseudorandom generator (PRG) , where is a polynomial function representing the length of the output.
The GGM construction proceeds as follows:
Step 1: Key Generation
- Generate a random seed of length , where is a security parameter.
- The key used for the GGM construction is the seed .
Step 2: Pseudorandom Function Evaluation
- To evaluate the pseudorandom function at a point , compute as follows:
where denotes concatenation, and represents the bitwise XOR operation.
The GGM construction is based on the observation that if is a one-way function, then the output is indistinguishable from a random string when given and . Additionally, the output of the PRG is indistinguishable from a random string when given . By XORing these two pseudorandom strings together, we get a new string that is still pseudorandom, as long as the PRG is secure. This is known as the hybrid argument.
The security of the GGM construction relies on the security properties of the one-way function and the pseudorandom generator . If the one-way function is hard to invert, and the PRG is secure, then the resulting function is a pseudorandom function, which means it behaves like a random function for any fixed key (seed ) and is computationally indistinguishable from a truly random function.
IND-CPA encryption
IND CPA stands for "Indistinguishability under Chosen-Plaintext Attack." It is a security property that cryptographic encryption schemes aim to achieve.
Basically, IND CPA means that an adversary should not be able to distinguish between the encryption of two different plaintext messages, even when they are given the power to choose the plaintexts they want to encrypt and observe the corresponding ciphertexts. This ensures that the encryption scheme provides confidentiality and prevents attackers from gaining useful information by analyzing ciphertexts generated from chosen plaintexts. It is a fundamental security requirement for modern encryption schemes.
Best to watch a good video on this here (opens in a new tab). There's not much textual information I can share with you beyond this, it's best you form a more intuitive understanding of this concept by watching the video.
In the next topic, I will use analogies to explain CPA and it's "counterpart": CCA (Chosen Ciphertext Attack). From there, you'll gain a better understanding.