From 57c23dcedeb448769e66761a5e2faa7320427b9f Mon Sep 17 00:00:00 2001 From: foswret Date: Sun, 22 Jun 2025 15:05:58 -0500 Subject: added key image to README.md --- .gitignore | 2 +- Makefile | 7 ++--- README.md | 7 +++-- main.c | 105 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ password.c | 81 ----------------------------------------------- 5 files changed, 113 insertions(+), 89 deletions(-) create mode 100644 main.c delete mode 100644 password.c diff --git a/.gitignore b/.gitignore index 53752db..a713bf2 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -output +spwdg diff --git a/Makefile b/Makefile index e7b7489..ef12eb2 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,6 @@ -password: password.c - gcc -o output password.c -lsodium -install: all - cp output spwdg +main: main.c + gcc -o spwdg main.c -lsodium +install: sudo mv spwdg /usr/bin uninstall: sudo rm /usr/bin/spwdg diff --git a/README.md b/README.md index 8cd127c..57d633e 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # SPWDG +![Key illustration, coutesy of Wikimedia Commons](https://commons.wikimedia.org/wiki/File:JapanHomes141_KEY_TO_KURA_,_AND_BUNCH_OF_KEYS.jpg) This is a simple password generator written in C. All randomness is produced by the [libsodium](https://github.com/jedisct1/libsodium) library. ## Dependencies @@ -7,10 +8,10 @@ This is a simple password generator written in C. All randomness is produced by - libsodium ## Install -- make -- sudo make install +- `make` +- `sudo make install` ## Uninstall -- sudo make uninstall +- `sudo make uninstall` diff --git a/main.c b/main.c new file mode 100644 index 0000000..66bb64e --- /dev/null +++ b/main.c @@ -0,0 +1,105 @@ +#include +#include +#include +#include +#include +#include //To Upper + + +long count_lines(FILE *File) { + char c; + long line_counter = 0; + while ((c = getc(File)) != EOF) { + if (c == '\n') { + line_counter++; + } + } + return(line_counter); +} + +void randomize_case(char *a) { // Accepts a string as input + for (int i = 0; i < strlen(a); i++) { + int coin = randombytes_uniform(2); // Decide if the current character will be capitalized or lowercase + if (coin == 1) { + a[i] = toupper(a[i]); + } + } +} + +void generate_integers(void) { + int length = 5; // TO-DO: Make random eventually + for (int i=0; i -#include -#include -#include -#include //To Upper - - -long count_lines(FILE *File) { - char c; - long line_counter = 0; - while ((c = getc(File)) != EOF) { - if (c == '\n') { - line_counter++; - } - } - return(line_counter); -} - -void randomize_case(char *a) { // Accepts a string as input - for (int i = 0; i < strlen(a); i++) { - int coin = randombytes_uniform(2); // Decide if the current character will be capitalized or lowercase - if (coin == 1) { - a[i] = toupper(a[i]); - } - } -} - -void generate_integers(void) { - int length = 5; // TO-DO: Make random eventually - for (int i=0; i