Given a “safe” (meaning: brute-force is your only shot) cryptographically strong PRNG, wouldn't it be safe to encrypt data using the CSPRNG to create a key as long as the data and then encrypt the data by XORing it with the key?

  • 2
    $\begingroup$ We call that a (synchronous) stream cipher. $\endgroup$ – CodesInChaos Nov 18 '17 at 10:02

Yes it would.

As CodesinChaos reminded us in his comment:

We call that a (synchronous) stream cipher.

Look up RC4 and A5/1, two of the most statistically popular ciphers in the universe. Also compare to a correctly generated one time pad. Not a lot else to say at this point.


The only secure-proven encryption scheme is the one-time-pad. That uses a key of plaintext-length for XOR-encryption once, else it is broken. If your CS-PRNG is not breakable, in sence of any attacker is able to win the predictable game, it is close to being a OTP.

Now think about you would like to encrypt a branch of Wikipedia. How would you like to (1) store and (2) transport the key secure? How would you make sure that no key is used twice?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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