complete keygen program
This commit is contained in:
parent
c5b2c0acf9
commit
fdeb0b4cb8
2 changed files with 52 additions and 0 deletions
39
pads/keygen.c
Normal file
39
pads/keygen.c
Normal 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
13
pads/makefile
Normal 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)
|
Loading…
Reference in a new issue