# If plaintext is random, how does it affect my choice of encryption algorithm?

I want to encrypt a key file, which is assumed to be truly random (generated with hardware RNG, for instance). Given that there are no patterns in the plaintext, what implications are there for my choice of encryption algorithm? Could I get away with something as trivial as a Vigenere cipher (or XOR equivalent)? Assuming the keyspace is substantially large to prevent brute-force attacks, what other vulnerabilities are there when the plaintext is random?

• In the research community there is some work in what we call entropic security which deals with this kind of question. In practice, however, is there a particular reason to not us a widely accepted standard? – mikeazo Mar 19 '12 at 20:52
• No good reason. Mostly just so I didn't have to put in the effort of finding, using, and distributing a library to do the encryption. But given the potential risks, I guess I'll just suck it up and find one =). Thanks for the lead on a new topic to study. – brianmearns Mar 20 '12 at 17:23
• As there is no connection between the plain texts, you may consider using symmetric ECB encryption. It's the one use case where it does no harm. Of course, ECB encryption does have very few benefits over CBC or - for parallelism/speed - CTR mode encryption, so you may as well forget about that too. – Maarten Bodewes Mar 20 '12 at 23:51

Generally, no, but it depends somewhat on what you want to do with your random file.

For example, let's say you want to send the random file to your friend for use as a one-time pad. Since you're worried that someone might be intercepting messages between you and your friend, you decide to encrypt the pad with a simple Vigenère cipher, like this:

$$P'_i = (P_i + K_{i \,{\bmod}\, L}) \bmod N$$

where $P$ is the original one-time pad, $P'$ is the encrypted pad, $K$ is a key (of length $L$) known to you and your friend, and $N$ is the size of the alphabet.

However, let's say that an adversary does intercept the encrypted pad $P'$ and saves a copy of it. When your friend uses the decrypted one-time pad $P$ to send you a message $M$ encrypted as

$$M'_i = (M_i + P_i) \bmod N$$

the adversary intercepts that too, and uses the encrypted pad $P'$ they captured to decrypt it:

\begin{aligned} M''_i &= (M'_i - P'_i) \bmod N \\ &= (M_i + P_i - P_i - K_{i \,{\bmod}\, L}) \bmod N \\ &= (M_i - K_{i \,{\bmod}\, L}) \bmod N \end{aligned}

Now they have a string $M''$ which is simply $M$ encrypted with the same simple Vigenère cipher that you used to encrypt $P$ into $P'$ (except that the key has been negated, but that's a minor detail), and they can use standard Vigenère cipher breaking techniques to try and recover $M$ fairly easily.

• Thank you, a very clear answer. I feel stupid for not thinking of this =). – brianmearns Mar 20 '12 at 17:21