Monday, May 29, 2017

Cryptography: TRNGs, PRNGs, and PRFs


Cryptographic applications typically make use of algorithmic techniques for random number generation.

These algorithms are deterministic and therefore produce sequences of numbers that are not statistically random.

However, if the algorithm is good, the resulting sequences will pass many reasonable tests of randomness. Such numbers are referred to as pseudorandom numbers.

PRNGs 

In contrast, a PRNG takes as input a fixed value, called the seed, and produces a sequence of output bits using a deterministic algorithm.

Typically, as shown, there is some feedback path by which some of the results of the algorithm are fed back as input as additional output bits are produced.

The important thing to note is that the output bit stream is determined solely by the input value or values, so that an adversary who knows the algorithm and the seed can reproduce the entire bit stream.


PRNGs Vs PRF 

Figure 7.1 shows two different forms of PRNGs, based on application.



Pseudorandom number generator: An algorithm that is used to produce an open-ended sequence of bits is referred to as a PRNG. A common application for an open-ended sequence of bits is as input to a symmetric stream cipher.



Pseudorandom function (PRF): A PRF is used to produced a pseudorandom string of bits of some fixed length. Examples are symmetric encryption keys and nonces. Typically, the PRF takes as input a seed plus some context specific values, such as a user ID or an application ID.

Other than the number of bits produced, there is no difference between a PRNG and a PRF.

The same algorithms can be used in both applications.

Both require a seed and both must exhibit randomness and unpredictability.

Further, a PRNG application may also employ context-specific input.

No comments:

Post a Comment