Take the 2-minute tour ×
Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. It's 100% free, no registration required.

As without using modes we can also encrypt and decrypt data then what is the need of using modes in DES?

share|improve this question
Without a mode you can encrypt exactly 8 bytes in a deterministic way. If you want to do anything more, you need a mode. –  CodesInChaos Aug 8 '13 at 10:57
If you look at it in a logical way, it's more the other way around; the mode uses the block cipher to perform the block encryption. It may also use a padding mechanism when required. –  owlstead Aug 8 '13 at 12:03
add comment

3 Answers

up vote 8 down vote accepted

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.

share|improve this answer
add comment
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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.