I see that in many applications stream ciphers are common than block cipher - whether is Salsa20, AES-GCM, etc. In which cases would a stream cipher be preferred over a block cipher and vice versa?

Also, why will we prefer to use a block cipher at all if we can use a stream cipher - which is faster, errors are not cumulative and doesn't require padding when the message has a different size than the block (like in ethernet encryption, where we have to pad the frame to multiplication of 16 if we want to use, for example, AES-CBC-128 block cipher)?

Thanks in advance

  • 2
    $\begingroup$ This question has a dupe or many dupes and in some sense broad. The idea is using a block cipher known to be secure and turn into steam cipher that doesn't need padding. All ciphers in TLS 1.3 are stream ciphers since we are tired of the padding oracle attacks. $\endgroup$
    – kelalaka
    Dec 22 '20 at 13:39
  • 1
    $\begingroup$ Is AES-GCM officially classified as a stream cipher or a block cipher? I consider it a 'block cipher mode of AES'. On the other hand, it is structured similarly to ChaCha20/Poly1305, which people appear to want to call a stream cipher. Perhaps the dichotomy of block cipher/stream cipher is becoming less useful... $\endgroup$
    – poncho
    Dec 22 '20 at 14:13
  • 1
    $\begingroup$ AES-GCM is a block cipher in a streaming mode. ChaCha20 is a permutation in a streaming mode. RC4 is a (broken) permutation in a streaming mode. I don't think there's really such a thing as a "pure" stream cipher that can't be considered as some other more primitive function in a streaming mode. But I'd say the dichotomy of block mode vs stream mode is useful. You could use a non-block cipher permutation like Gimli in a streaming mode, or in a block mode like CBC. The former wouldn't need padding, the latter would. Maybe padded vs unpadded is a better distinction? $\endgroup$ Dec 23 '20 at 14:20

Your Answer

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

Browse other questions tagged or ask your own question.