0

I have to decrypt an encrypted message in C program which has been encrypted using 3DESm method in CBC mode. It looks quite different from the encrypted message that we get from 3DES method. Generally the ciphertext that we get after encrypting from is a hexadecimal number which is of length 16 and has includes the characters like 0-9 and A-F only. But the ciphertext that I need to decrypt is more than 20 characters in length and includes all characters from A-Z, a-z , 0-9 and also includes few special characters like '+' and '='. Which library would be helpful to do the needful?

Manas
  • 84
  • 2
  • 7
  • What's 3DESm? never heard of it, and google doesn't turn up anything useful either. You're the top rated google result for it by now. – CodesInChaos May 11 '12 at 08:42

1 Answers1

1

The ciphertext you get from any normal blockcipher consistst of raw bytes/ binary data, not hex. In the case of DES these are 8 bytes per block.

You can then encode them, if you prefer text over binary data. Looks like your ciphertext was Base64 and not Hex encoded. But that's a choice independent from the choice of cipher.

Base64 uses all ASCII letters and numbers as well as + and / to encode the data, and = as padding if the input isn't a multiple of 6 bits.

CodesInChaos
  • 106,488
  • 23
  • 218
  • 262
  • Do you know any method of encryption called 3DESm? I got a link from google which tells about 3DESm. http://www.ehow.com/how_7182202_encrypt-file-php.html But it tells about PHP and I want my program to be in C because it has to be a part of a larger program in C. – Manas May 11 '12 at 09:00
  • 1
    @Manas It looks like a typo. `m` and `,` are next to each other on the keyboard, so it's likely that the author hit the `m` by accident. – CodesInChaos May 11 '12 at 09:31
  • If this isn't homework, why aren't you using AES? And the example uses ECB mode, which should be avoided. – CodesInChaos May 11 '12 at 09:32
  • This isn't homework that's why I am constrained. I have to use 3DESm or maybe 3DES if it is a typing mistake in C and decrypt the encrypted value which I have got. – Manas May 11 '12 at 10:54