As without using modes we can also encrypt and decrypt data then what is the need of using modes in DES?
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
DES is a block cipher. It consists of a pair of algorithms, one for encryption and one for decryption. Each algorithm takes two inputs: the key, and the block to encrypt or decrypt; the output is the encrypted or decrypted block. For DES, the size of a block is 64 bits. So DES only tells you how to encrypt or decrypt data that consists of exactly 64 bits.
If you have more or less than 64 bits of data, you need to specify how the data is split into 64-bit blocks, what processing to apply to each block, and how to combine the output blocks together. By definition, this is called a mode of operation. Usually the splitting and combining is trivial, but the part about processing each block can be more or less complex.
Even when you happen to have exactly one block of data, modes can achieve things that DES alone doesn't. In particular, DES is deterministic: encrypting the same plaintext with the same key always leads to the same ciphertext. All good modes include a unique tag as part of the encrypted data (called an initialization vector in most modes), so that no two runs of the encryption algorithm ever produce the same ciphertext, which avoids leaking the fact that two messages are equal. Modes can also build algorithms that do things other than encryption, such as a message authentication code, or authenticated encryption which combines encryption and MAC together in a single algorithm.
Most real-world encryption is based on block ciphers, which transform fixed-sized inputs into fixed-sized outputs. Since real-world inputs aren’t exactly 8 or 16 bytes wide, ciphers are adapted to them with a block mode. Of the available block modes, ECB is the simplest to understand. It’s the mode you’d design yourself, the first time you confronted a block cipher: divide the input into blocks, and apply the cipher to each independently. ECB mode is so widespread that we call it “the default mode”.
As said in this block, encryption algorithms are able to encrypt just one block, but usually, a message to protect is longer, for this reason you should chop it and encrypt every single piece, to bind them togheter you need a mode.
Have a look at this article: Wikipedia: cypher modes of operation
Different modes give different bonuses: ECB can be parallelized and is faster, while OFB gives a better diffusion and is more secure. There are many other modes, as you can see in the mentioned article. You can also use these modes with other block encryption algorithms like Rijndael for example.