Not that I have actually done this and tested it, but you should
just be able to replace DES with DES_EDE3 in the mode template declaration
for the encryptor. After that you would need to adjust the key size.
DES_EDE2 should work the same way with a 112 bit key.
Good luck,
Shawn
> -----Original Message-----
> From: Edmund Wong [mailto:[EMAIL PROTECTED]
> Sent: Friday, May 21, 2004 11:26 AM
> To: [EMAIL PROTECTED]
> Subject: 3DES Question
>
> Hello,
> I've used the "How to use a block cipher in 5.0" in the FAQs and slightly
> modified it to use it with DES. Does anyone know how I can modify it so it
> uses 3DES (Triple DES)?
> Any help would be great!
> Here is my current code, I am using Crypto++ 5.1:
>
> const byte key2[] = {0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40};//The
> same as
> @@@@@@@@ converted to ascii value then to Hex
> const byte iv2[] = {0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40
> byte plaintext[32];
> string MyText = "Chickens";
> for(int x = 0; x<8; x++)
> {
> plaintext[x] = MyText[x];
> }
>
> byte ciphertext2[32];
> CBC_Mode<DES>::Encryption encryption_DES_CBC;
> encryption_DES_CBC.SetKeyWithIV(key2, 8, iv2);//8x8bits = 64 bit
> key, 64bit
> IV
> encryption_DES_CBC.ProcessString(ciphertext2, plaintext,8);
> string temp2;
> HexEncoder(new StringSink(temp2)).Put(ciphertext2,8);
> HexEncoder(new FileSink("DES.txt")).Put(ciphertext2,8);
> cout<<"C: "<<temp2<<endl<<endl;
>
> Thanks,
>
> New to Crypto++,
> Edmund