What is the difference Between Block Cipher and Stream Cipher?

Technology CommunityCategory: ConcurrencyWhat is the difference Between Block Cipher and Stream Cipher?
VietMX Staff asked 3 years ago

Block Cipher and Stream Cipher are the methods used for converting the plain text into cipher text directly and belong to the family of symmetric key ciphers.

The major difference between a block cipher and a stream cipher is that the block cipher encrypts and decrypts a block of the text at a time. On the other hand, stream cipher encrypts and decrypts the text by taking the one byte of the text at a time.

  • Stream ciphers are typically faster than block, but that has it’s own price.
  • Block ciphers typically require more memory, since they work on larger chunks of data and often have “carry over” from previous blocks, whereas since stream ciphers work on only a few bits at a time they have relatively low memory requirements (and therefore cheaper to implement in limited scenarios such as embedded devices, firmware, and esp. hardware).
  • Stream ciphers are more difficult to implement correctly, and prone to weaknesses based on usage – since the principles are similar to one-time pad, the keystream has very strict requirements. On the other hand, that’s usually the tricky part, and can be offloaded to e.g. an external box.
  • Because block ciphers encrypt a whole block at a time (and furthermore have “feedback” modes which are most recommended), they are more susceptible to noise in transmission, that is if you mess up one part of the data, all the rest is probably unrecoverable. Whereas with stream ciphers bytes are individually encrypted with no connection to other chunks of data (in most ciphers/modes), and often have support for interruptions on the line.
  • Also, stream ciphers do not provide integrity protection or authentication, whereas some block ciphers (depending on mode) can provide integrity protection, in addition to confidentiality.
  • Because of all the above, stream ciphers are usually best for cases where the amount of data is either unknown, or continuous – such as network streams. Block ciphers, on the other hand, or more useful when the amount of data is pre-known – such as a file, data fields, or request/response protocols, such as HTTP where the length of the total message is known already at the beginning.