summaryrefslogtreecommitdiff
path: root/C/HF/chap7/ecat.c
blob: 8ee5e6a433e846cfb4db74460ac87f6d78fb11af (plain)
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
#include <stdio.h>
#include "xor.h"
#include "encrypt.h"

int main(int argc, char **argv)
{
	FILE *fd;
	char buf[80];

	encrypt_arr_t fn_arr = {xor16, xor42, xor64};
	if (argc != 2)
		return 1;

	printf("Arr size: %ld\n", sizeof(fn_arr) / sizeof(*fn_arr));
	fd = fopen(argv[1], "r");

	while (fgets(buf, 80, fd)) {
		encrypt_arr(buf, fn_arr, 3);
		printf("%s", buf);
	}

	printf("\n");
	fclose(fd);
	return 0;
}