1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | #include <stdio.h> #include <string.h> #define CBC 1 #define ECB 0 #include "aes.h" int main(void) { int I, Len; char In[]="Hello AES128..."; BYTE Key[]={0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c}; BYTE EncBuff[80]; BYTE DecBuff[80]; printf("Testing AES128\n\n"); printf("OrgString: '%s'\n", In); Len=strlen(In)+1; AES_ECB_Encrypt(In, Key, EncBuff, Len); printf("Encorded: "); for (I=0; I<Len; I++) printf(" %02X", EncBuff[I]); printf("\n"); memset(DecBuff, 0, sizeof(DecBuff)); AES_ECB_Decrypt(EncBuff, Key, DecBuff, Len); printf("Decorded: '%s'\n", DecBuff); return 0; } | cs |
예전 오픈채팅방에서 고수분한테 받은 자료다.
댓글