最近我尝试使用aman-256(http://www.gladman.me.uk/)的gladman库,我在ecb中获得加密和解密工作,但问题是我无法获得与其他工具相同的结果(对于例如在线工具),我使用长度为32位的ecb模式。
AESencrypt encriptador; //class encrypt
unsigned char *keymain=new unsigned char[256]; // in this lines i probe putt the value of password in the begin or end of array, but i dong't get the correct answer.
//
memset(keymain,0,sizeof(char)*256);//
keymain[0]= 61;
AESdecrypt desencriptador; //class decrypt
encriptador.key( keymain, 256 ); // assign the key the member id definited by library of gledman
desencriptador.key( keymain, 256 ); //
unsigned char *ab= new unsigned char[88];
unsigned char *ac= new unsigned char[88];
memset(ab, 0, 88*sizeof(char));
memset(ac, 0, 88*sizeof(char));
unsigned char *ad=new unsigned char[44];
char *az=new char[4];
memset(az, 0, (sizeof(char)*4));
az[0]='c';
az[1]='o';
az[2]='n';
memset(ad, 0, (44*sizeof(char)));
cout<<"cadena de ejemplo"<<az<<endl;
encriptador.ecb_encrypt( reinterpret_cast<unsigned char*>(az), ab, 32); //ecb_encrypt is definited by gledman library, az is buffer enter, and ab is buffer exit.
QByteArray arreglo=QByteArray(reinterpret_cast<const char*>(ab));
qDebug()<<"cadena en base64: "<<arreglo.toBase64();
qDebug()<<"cadena en hexadecimal: "<<arreglo.toHex();
desencriptador.ecb_decrypt(ab, ac, 32); //ecb_decrypt is definited by gledman library, ab is buffer enter and ac is buffer out
cout<<"su cadena original debe ser: "<<ac<<endl; //i get the original string but i don't get the same value with other tool
好吧,我知道关键和值的答案文件,但是我无法改变块的位置。