blob: b8670c5936afc2112cfb96fa841f18e8d40b42b3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
#include "lib.h"
int main(int argc, char **argv)
{
if (argc != 3) {
printf("Usage: %s <cleartext> <key>\n\noutput: ciphertext\n", argv[0]);
exit(1);
}
char *ciphertext = malloc(strlen(argv[1])+1);
char *hex_ciphertext = malloc(strlen(argv[1])*2);
xor_string(argv[1], argv[2], ciphertext, strlen(argv[2]), strlen(argv[1]));
hex_binary_to_string(ciphertext, hex_ciphertext, strlen(argv[1]));
printf("%s\n", hex_ciphertext);
return 0;
}
|