新手上路
- 积分
- 44
- 金钱
- 44
- 注册时间
- 2019-8-28
- 在线时间
- 10 小时
|
发表于 2019-9-9 23:25:45
|
显示全部楼层
请教楼主:这个AES加密和解密好像不行。 改下就可以。是不是我理解错了 这么改采仿真才是对的 void aesDecrypt( unsigned char * buffer, unsigned char * chainBlock )//解密 { // aesDecInit(); // CopyBytes( tempbuf, buffer, BLOCKSIZE ); // InvCipher( buffer, expandedKey ); // XORBytes( buffer, chainBlock, BLOCKSIZE ); // CopyBytes( chainBlock, tempbuf, BLOCKSIZE ); aesDecInit(); CopyBytes( buffer, chainBlock, BLOCKSIZE ); InvCipher( buffer, expandedKey ); // XORBytes( buffer, chainBlock, BLOCKSIZE ); CopyBytes( chainBlock, buffer, BLOCKSIZE ); } //buffer 加密缓存, chainblock要加密的块 void aesEncrypt( unsigned char * buffer, unsigned char * chainBlock )//加密 { // aesEncInit(); // XORBytes( buffer, chainBlock, BLOCKSIZE ); // Cipher( buffer, expandedKey ); // CopyBytes( chainBlock, buffer, BLOCKSIZE ); aesEncInit(); CopyBytes( buffer, chainBlock, BLOCKSIZE ); Cipher( buffer, expandedKey ); CopyBytes( chainBlock, buffer, BLOCKSIZE ); } |
|