Hi.
I did some works about DES in java. All perfect but it's slow. Now i
am doing the same but in C++.
I saw this page : http://www.itl.nist.gov/fipspubs/fip81.htm and i
want to check if these examples work flawless but it didnt't .......
For example :
AN EXAMPLE OF THE CIPHER BLOCK CHAINING (CBC) MODE
The CBC mode in the encrypt state has been selected.
Cryptographic Key = 0123456789abcdef
Initialization Vector = 1234567890abcdef
The plain text is the ASCII code for "Now is the time for all ." These
seven- bit characters are written in hexadecimal notation
(0,b7,b6,...b1).
TIME PLAINTEXT DES INPUT DES OUTPUT CIPHERTEXT
BLOCK BLOCK
1. 4e6f772069732074 | 5c5b2158f9d8ed9b | e5c7cdde872bf27c |
e5c7cdde872bf27c this is the final output
My output is : 9a8836c32........... instead of e5c7cdde872bf27c
This is my code :
// Runtime Includes
#include <iostream>
// Crypto++ Includes
#include "aes.h"
#include "modes.h" // xxx_Mode< >
#include "filters.h" // StringSource and
#include "cryptlib.h" // StreamTransformation
#include "filters.h"
#include "gcm.h"
#include "des.h"
#include "hex.h"
using namespace std;
using namespace CryptoPP;
// Crypto++ Library
#ifdef _DEBUG
# pragma comment ( lib, "cryptlibd" )
#else
# pragma comment ( lib, "cryptlib" )
#endif
void main(void)
{
byte key[]=
{'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'};
byte iv[]=
{'1','2','3','4','5','6','7','8','9','0','a','b','c','d','e','f'};
byte PlainText[]= { 0x4e , 0x6f , 0x77 ,0x20, 0x69, 0x73 ,0x20 ,
0x74} ;
byte cbCipherText[ 64 ] ;
CryptoPP::ECB_Mode< CryptoPP::DES >::Encryption Encryptor;
Encryptor.SetKey( key, 8);
Encryptor.ProcessData( cbCipherText,PlainText, 64);
cout << "hash: ";
for (numero=0;numero<16;numero++)
{
printf("%x",cbCipherText[numero]);
}
}
Why is it not working?
If anybody could help me.. thanks in advance
Greetings ,
Francisco
--
You received this message because you are subscribed to the "Crypto++ Users"
Google Group.
To unsubscribe, send an email to [email protected].
More information about Crypto++ and this group is available at
http://www.cryptopp.com.