Open In App

PRG, PRF and PRP in Cryptography

Last Updated : 09 Mar, 2023
Like Article

Cryptography is the study and practice of techniques for secure communication in the presence of third parties called adversaries. It deals with developing and analyzing protocols that prevent malicious third parties from retrieving information being shared between two entities thereby following the various aspects of information security. 

In this article, we will see PRG, PRF, and PRP in Cryptography. 

Pseudo-Random Generator(PRG)

Pseudo-Random Generator is used to encrypt long messages using short keys. It is used for COA security. In symmetric key encryption, we learned in perfect secrecy (one-time pad) that a computationally unbounded adversary cannot distinguish whether cipher text ‘c’ is an encryption of which plain text.

Now due to the disadvantages of the one-time pad algorithm, we will modify it to make it more feasible.

Suppose this scenario, 

Encryption using PRG

Encryption using PRG

We are using a function G which takes an input of size l and returns an output of size L, where l << L


  • Instead of the sender and receiver agreeing upon a key as large as the message, a uniformly random string will be used.
  • The sender cannot simply XOR the message with the key, instead, the XOR operation will be done with the output of G.

A computationally bounded adversary cannot distinguish between a uniformly random string {0, 1}L and G(s). Here, the function G is a pseudo-random generator,

Pseudo-Random Generator

Requirements :

  • G should be an efficient algorithm.
  • Expanded string L should be greater than l.
  • The output behavior of G and a true random generator should be identical.

Security Properties :

  • It can be always distinguished by a brute force distinguisher.

Instantiations :

  • One-way function
  • RC-4

Pseudo-Random Function(PRF)

Pseudo-Random Function(PRF)  is a deterministic algorithm with 2 inputs and a single output.

Pseudo-Random Function

Pseudo-Random Function

If we fix the key, it is then called a single-input keyed PRF, and is denoted as Fk: {0, 1}l -> {0, 1}L Notice that the size of the key and block can be different from the output.

Pseudo-Random Permutation(PRP)

Pseudo-Random Permutation(PRP) is a deterministic algorithm with 2 inputs and a single output.

Pseudo-Random Permutation

Pseudo-Random Permutation

Here the relation between the mapping is a bijection.

Relation between PRF and PRP :

  • PRP has one-to-one and onto mapping, whereas PRF may or may not.
  • A PRF that is not a bijection, can’t be a PRP.
  • If P is a secure PRP, then it is also a secure PRF given (size of key <= size of output).
  • Both are used for CPA security.

Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads