diff options
| author | Carlos Maiolino <[email protected]> | 2025-09-06 11:12:35 +0200 |
|---|---|---|
| committer | Carlos Maiolino <[email protected]> | 2025-09-06 11:12:35 +0200 |
| commit | 133a564a7ba1f57ff229e7c181227d43b4bae584 (patch) | |
| tree | 4377f34caf6abaa71621666aee3061e58c84f5d3 /C/HF/chap8/src/ecat.c | |
| parent | 2c9056a23e1a55fd21a8e314c903d9325bffd62e (diff) | |
Create ecat based on a lib archive
Signed-off-by: Carlos Maiolino <[email protected]>
Diffstat (limited to 'C/HF/chap8/src/ecat.c')
| -rw-r--r-- | C/HF/chap8/src/ecat.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/C/HF/chap8/src/ecat.c b/C/HF/chap8/src/ecat.c new file mode 100644 index 0000000..9be8a47 --- /dev/null +++ b/C/HF/chap8/src/ecat.c @@ -0,0 +1,29 @@ +#include <stdio.h> +#include <libs/xor.h> +#include <libs/encrypt.h> + +int main(int argc, char **argv) +{ + FILE *fd; + char buf[80]; + + char f = '\0'; + + 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("encrypted message: '%s'", buf); + } + + printf("\n"); + + printf("%c", (char)(f ^ 16 ^ 42 ^ 64)); + fclose(fd); + return 0; +} |
