7
$\begingroup$

If one wishes to encrypt one can either use a pseudo random generator to generate a long sequence and then xor it with plaintext, similarly he can use the seed as key to encrypt the plaintext using block encryption. If encryption is not of paramount concern, which runs faster, pseudo random generator or block encryption?

I would highly appreciate if there is some survey or report on the running time comparisons.

$\endgroup$
  • $\begingroup$ Highly depends on the PRNG. Some, like Fortuna, use encryption algorithms to output the pseudo random data, so those probably will not be faster. Maybe if you take a stream cipher you could achieve faster data generation... $\endgroup$ – Fleeep Oct 28 '15 at 9:05
7
$\begingroup$

Dedicated stream ciphers typically are, or at least can be, somewhat faster than constructions based on block ciphers. (If they weren't, there would be no point in using them, since a block cipher can do everything a dedicated stream cipher can.) What you gain in speed (and possibly code size), however, you lose in versatility:

  • A block cipher (in CTR / OFB mode) can be used to build a stream cipher. There is no simple way to construct a block cipher out of a stream cipher.

  • Block ciphers can also be used to construct many other useful cryptographic tools, such as MACs and hash functions. Stream ciphers are typically only good for encrypting streams of data.

  • In particular, a single block cipher can be used to construct a fully IND-CCA2 secure authenticated encryption scheme. Stream ciphers do not generally include authentication, and thus cannot protect data from tampering.

  • Several block cipher modes of operation (most notably CTR mode, but also CBC and CFB to a limited extent) have the useful properties of parallelizability and seekability — that is, the en/decryption of different parts of the data can be done in parallel, and it's possible to start decryption from any point in the data stream.

Because of their versatility, block ciphers like AES are also popular candidates for fast hardware implementation. If you have a fast block cipher implemented in hardware, there's a good chance that it'll be faster than any dedicated stream cipher you could implement in software.

All that said, some of the fastest dedicated stream ciphers can be very fast, both in hardware and in software, and many are also designed to be very compact in terms of code/circuit size. If you really only need stream encryption (or random number generation), a dedicated stream cipher may be more efficient than a block cipher.

See also: Difference between stream cipher and block cipher

$\endgroup$
  • $\begingroup$ Can you give an example of such a stream cipher that is still secure? $\endgroup$ – Demi May 21 '16 at 1:19
  • $\begingroup$ @Demetri: Any of the ciphers in the eSTREAM portfolio should fit; none of them have been broken yet (even in the academic sense, AFAIK) after a decade of cryptanalysis, although several have known attacks that either break a reduced-strength version of the cipher or come close to being faster than brute force on the full cipher. Also note that some (but certainly not all) of the eSTREAM ciphers have a rather small keyspace to begin with. $\endgroup$ – Ilmari Karonen May 21 '16 at 10:08

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.