From b2df2a824a78f2beebdbc0c0d5b08bb0bd566c4b Mon Sep 17 00:00:00 2001 From: chupax Date: Tue, 20 Aug 2024 09:50:20 -0500 Subject: First commit Generates one random password. 5 digit number, random word w/ random case, and random characters --- password.c | 89 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 password.c (limited to 'password.c') diff --git a/password.c b/password.c new file mode 100644 index 0000000..e028b61 --- /dev/null +++ b/password.c @@ -0,0 +1,89 @@ +// https://github.com/dwyl/english-words + +#include +#include +#include +#include +#include +#include //To Upper + + +long count_lines(FILE *File) { // Accepts file as input + char c; + long line_counter = 0; + while ((c = getc(File)) != EOF) { + if (c == '\n') { + line_counter++; // Increment when each line number is passed + } + } + return(line_counter); // Return the found value +} + +void randomize_case(char *a) { // Accepts a string as input + for (int i = 0; i < strlen(a); i++) { // Loop through the length of the string + int coin = randombytes_uniform(2); // Decide if the current character will be capitalized or lowercase + if (coin == 1) { + a[i] = toupper(a[i]); // Change current character into a capital + } + } +} + +void generate_integers(void) { // Generates a string of random integers + int length = 5; // TO-DO: Make random eventually + for (int i=0; i