#include #include #include #include "aes.h" //#define PaddingMode_None #define PaddingMode_Zeros //#define PaddingMode_PKCS5or7 #define MAXLEN 1024 void printASCCI(char *str, int len) { int c,i; for(i = 0; i < len; i++) { c = (int)*str++; c = c & 0x000000ff; printf("0x%x ", c); } printf("\n"); } int main(int argc, char const *argv[]) { char key[17] = "abcdefghigklmnop"; int klen; char p[MAXLEN]="ABCDEFGHIGKLMN0"; int plen = strlen(p); printf("AES...ing..................\n"); if(plen == 0) { printf("plen erro?\n"); return ; } #ifdef PaddingMode_Zeros if(plen % 16 != 0) plen=(16 - plen%16) + plen; else plen+=16; #endif #ifdef PaddingMode_PKCS5or7 if(plen % 16 != 0) { int len_num = 16 - plen%16; int i = 0; for(i;i