Stream Cipher and Block Cipher


The main difference between stream cipher and block cipher

A typical stream cipher encrypts plain text one byte at a time, although a stream cipher may be designed to operate on one bit at a time or on units larger than a byte at a time. That means we can also encrypt a block of one byte by help of a stream cipher as a stream.

A stream cipher encrypts plaintext messages by applying an encryption algorithm with a pseudorandom cipher digit stream (keystream). Each bit of the message is encrypted one by one with the corresponding keystream digit. Stream ciphers are typically used in cases where speed and simplicity are both requirements. If a 128 bit block cipher such as AES were to be used in place of a stream cipher where it was encrypting messages of 32 bit blocks, 96 bits of padding would remain. This is an inefficient approach and one reason why a stream cipher would be preferred, since they operate on the smallest possible unit.

Some common stream ciphers include RC4 (which has been shown to be vulnerable to attacks), Salsa20, ChaCha (a seemingly better variant of Salsa20), Rabbit, and HC-256, among others. Block ciphers can be used in stream mode to act as a stream cipher. If a block cipher is run in CFB, OFB, or CTR mode, it does not require additional measures to handle messages that aren’t equivalent to the length of multiples of the block size and eliminates the padding effect.

Comments

Popular posts from this blog

Introduction to Encryption

How to do a Phishing attack on Facebook?

RESTful API