complete keygen program

This commit is contained in:
stitchy 2023-12-06 21:00:18 +00:00
parent c5b2c0acf9
commit fdeb0b4cb8
Signed by: stitchy
SSH key fingerprint: SHA256:yz2SoxdnY67tfY5Jzb0f2v8f5W3o/IF359kbcquWip8
2 changed files with 52 additions and 0 deletions

39
pads/keygen.c Normal file
View file

@ -0,0 +1,39 @@
#include "stdio.h"
#include "stdlib.h"
#include "time.h"
#include "string.h"
int main(int arg, char** args) {
if(arg < 2) {
printf("Not enough Args\n");
return 1;
}
int num_chars = atoi(args[1]);
char* crypto = malloc(sizeof(char) * (num_chars + 10));
srand(time(NULL));
char* tempstr = malloc(sizeof(char) * 2);
while(num_chars) {
char temp = 'A' + (rand() % 26);
sprintf(tempstr, "%c", temp);
strncat(crypto, tempstr, 1);
num_chars--;
}
printf("%s\n", crypto);
return 0;
}

13
pads/makefile Normal file
View file

@ -0,0 +1,13 @@
CC=gcc --std=gnu99 -g
all: keygen
echo Everything Made
keygen: keygen.c
$(CC) keygen.c -o keygen
run: all
./$(output)
clean:
rm -fr *.o vgcore.* $(output)