summaryrefslogtreecommitdiff
path: root/C/HF/chap7/ecat.c
diff options
context:
space:
mode:
Diffstat (limited to 'C/HF/chap7/ecat.c')
-rw-r--r--C/HF/chap7/ecat.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/C/HF/chap7/ecat.c b/C/HF/chap7/ecat.c
new file mode 100644
index 0000000..ec034e4
--- /dev/null
+++ b/C/HF/chap7/ecat.c
@@ -0,0 +1,23 @@
+#include <stdio.h>
+#include "xor.h"
+#include "encrypt.h"
+
+int main(int argc, char **argv)
+{
+ FILE *fd;
+ char buf[80];
+
+ if (argc != 2)
+ return 1;
+
+ fd = fopen(argv[1], "r");
+
+ while (fgets(buf, 80, fd)) {
+ encrypt(buf, xor64);
+ printf("%s", buf);
+ }
+
+ printf("\n");
+ fclose(fd);
+ return 0;
+}