7 unsigned char key[256];
8 unsigned char plain[256];
9 unsigned char plain2[256];
10 unsigned char cipher[256];
11 memset(&key, 0, sizeof(key));
12 memset(&plain, 0, sizeof(plain));
13 memset(&plain2, 0, sizeof(plain2));
14 memset(&cipher, 0, sizeof(cipher));
16 fprintf(stderr, "\nKey:\n");
17 for (i = 0; i < sizeof(key) / 2; i++) {
20 fprintf(stderr, "%02x%02x ", key[i], key[i+1]);
23 fprintf(stderr, "\nSetting key\n");
26 fprintf(stderr, "\nPlaintext:\n");
27 for (i = 0; i < sizeof(plain) / 2; i++) {
30 fprintf(stderr, "%02x%02x ", plain[i], plain[i+1]);
33 fprintf(stderr, "Encrypting\n");
34 encrypt(plain, cipher);
36 fprintf(stderr, "\nCiphertext:\n");
37 for (i = 0; i < sizeof(cipher); i++) {
38 fprintf(stderr, "%02x", cipher[i]);
41 fprintf(stderr, "Decrypting\n");
42 decrypt(cipher, plain2);
44 fprintf(stderr, "\nDecryptedtext:\n");
45 for (i = 0; i < sizeof(plain2); i++) {
46 fprintf(stderr, "%02x", plain2[i]);