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!

  • 2
    $\begingroup$ In general, it can't. $\endgroup$
    – Maeher
    Commented Apr 7, 2020 at 14:05
  • $\begingroup$ 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)? $\endgroup$
    – fgrieu
    Commented Apr 7, 2020 at 14:05
  • $\begingroup$ is it the brute-force attack? $\endgroup$ Commented Apr 7, 2020 at 14:16
  • $\begingroup$ What would happen if you would encrypt a stream of zero bits? How does the ciphertext behave? $\endgroup$
    – Maarten Bodewes
    Commented Apr 7, 2020 at 22:53
  • 1
    $\begingroup$ 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? $\endgroup$
    – SEJPM
    Commented Apr 8, 2020 at 9:34

3 Answers 3


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.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.