From f0d73a3137f3d0525a1a3118eb4f748e0fbefb6d Mon Sep 17 00:00:00 2001 From: blackbeard420 Date: Mon, 6 Nov 2023 21:28:32 -0500 Subject: [PATCH] initial commit --- fxkr.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ makefile | 3 +++ 2 files changed, 49 insertions(+) create mode 100644 fxkr.c create mode 100644 makefile diff --git a/fxkr.c b/fxkr.c new file mode 100644 index 0000000..a15a905 --- /dev/null +++ b/fxkr.c @@ -0,0 +1,46 @@ +#include +#include +#include + +int +get_char_int(char in) +{ + char buf[2]; + buf[0] = in; + buf[1] = 0; + return atoi(buf); +} + +char* +decode(char *in) +{ + static char result[9]; + int idx = 0; + + if (strlen(in) != 16) { + return NULL; + } + + for (int i = 0; i < 15; i += 2, ++idx) { + int first = get_char_int(in[i]); + int second = get_char_int(in[i+1]); + result[idx] = first * 16 + second; + } + + result[8] = 0; + + return &result[0]; +} + + +int +main(int argc, char **argv) +{ + char *input = "3041314232433344"; + char *result = decode(input); + + printf("keyword is: %s\n", result); + + return 0; +} + diff --git a/makefile b/makefile new file mode 100644 index 0000000..f854873 --- /dev/null +++ b/makefile @@ -0,0 +1,3 @@ +CFLAGS = -Wall + +all: fxkr