initial commit

This commit is contained in:
blackbeard420 2023-11-06 21:28:32 -05:00
commit f0d73a3137
2 changed files with 49 additions and 0 deletions

46
fxkr.c Normal file
View File

@ -0,0 +1,46 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
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;
}

3
makefile Normal file
View File

@ -0,0 +1,3 @@
CFLAGS = -Wall
all: fxkr