# Why can a symmetric encryption algorithm be considered a pseudo-random number generation algorithm?

I have a question from my teacher: "Why can a symmetric encryption algorithm be considered a pseudo-random number generation algorithm?

Can anyone explain it to me?

And sorry if my english is not good!

• In general, it can't. Commented Apr 7, 2020 at 14:05
• Hint: what's the outcome of encrypting a moderate number of incremental values with a symmetric encryption algorithm (that has the same plaintext and ciphertext space, like a block cipher)?
– fgrieu
Commented Apr 7, 2020 at 14:05
• is it the brute-force attack? Commented Apr 7, 2020 at 14:16
• What would happen if you would encrypt a stream of zero bits? How does the ciphertext behave? Commented Apr 7, 2020 at 22:53
• Also would a symmetric encryption algorithm that securely encrypted a message and then appended 1kB of all-0 bytes still be a secure symmetric encryption scheme? Commented Apr 8, 2020 at 9:34

Here are two standard (and equivalent) definitions of confidentiality in symmetric encryption. If Alice sends Bob a message and Eve manages to see it in transit, Eve cannot (without an unreasonable amount of computation):

1. Learn any fact about the plaintext other than possibly its length (semantic security);
2. Tell the ciphertext apart from random data of the same length (ciphertext indistinguishability).

The latter criterion indirectly answers to your question. One way to implement a pseudorandom number generator is just to encrypt arbitrary inputs—say, encrypt the all zeroes string and use the ciphertexts as the pseudorandom output.

This also works in the opposite direction—if you have a secure pseudorandom generator, you can build a secure cipher out of it (called a stream cipher) by XORing its output with the messages. So in that sense, encrypting messages confidentially and generating secure pseudorandom numbers are equivalent problems.

As you might know, a symmetric encryption algorithm is defined by a single key shared by two parties and the messages are encrypted and decrypted by this same key. We have two kinds of symmetric encryption algorithms: Stream Ciphers and Block Ciphers.

A Stream Cipher works as a Cryptographic Pseudo Random Number Generator (CPRNG) that uses the key as the seed, then uses the generated number to perform a XOR with your plaintext to get the ciphertext.

So you can use any Stream Cipher as a PRNG by successively encrypting the result of an encryption. You can also perform this using Block Ciphers, but they are much slower than Stream Ciphers.

In 2019 I developped an algorithm which uses a Stream Cipher, Salsa20, as a CSPRNG. https://github.com/mafone/RKHC. Now I need to improve this.

Well, like the comments say, it can't. But maybe i can give you a hint, to what i may be related. Shanon worked on perfect security. One of his principes is, that the decrypt and encrypt text are stochatic stochatically independent. Some symmetric system (e.g. one time pad) are perfect secure.

I don't know the context of your teachers question, but this may give you an idea, where you can find an answer.