0

I read about the CBC mode of encryption in wikipedia where it said that in 3DES method a message is divided into 16 digit blocks each and then they are encrypted or decrypted. Every block which is encrypted is XORed with the next plaintext and then it is encrypted. I got this information from here well explained in a diagram. http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Cipher-block_chaining_.28CBC.29

My problem is that I have to decrypt a message of length 14, so it will be a single block. So now how am I going to implement CBC for such a small message? There won't be next block to be XORed with.

Manas
  • 84
  • 2
  • 7

1 Answers1

2

CBC and other modes of operation exist to allow, "the repeated and secure use of a block cipher under a single key," as the linked Wikipedia article states. This is needed to eliminate patterns in data, as you can see in the picture of the encrypted Tux. Since you are only encrypting one block worth of data (2 bytes short of this, no less), then you can use the simplest technique, ECB, which simply passes in your plaintext and generates some ciphertext.

If you were panning on encrypting several of these 14 byte messages, then you would potentially want to consider using CBC to avoid exposing repetition in your encrypted data.

101100
  • 2,666
  • 23
  • 28
  • No. I have a single 14 character encrypted data which has been encrypted using CBC mode. So now I have to decrypt it using CBC mode only. I read wikipedia only and came to know about the 3DES algorithm. I had a silly doubt which I am clear about now. Actually I got confused by seeing the diagram. Actually the string that I have will be encrypted 3 times using DES algorithm and it is done everytime with the previous step's result. So I don't need to worry that whether my message is of length less than 16. Anyway thanks 101100. – Manas May 11 '12 at 08:44