You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Genpassword is a C library for generating unique passwords. Currently, the only available character pool for passwords is [a-zA-Z0-9].
char*generate_password(intlength);
Important Note: It is necessary to seed your own random for security reasons. Never seed more than once, unless you know what you are doing!
Installation
Installation of this library is accomplished via CLib.
$ clib install boboman13/genpassword.c
This will give you a deps folder with the library.
Example
#include<stdio.h>#include<time.h>#include"deps/genpassword.c/genpassword.c"intmain() {
// This is where we seed.srand(time(NULL));
intlength=10;
char*password=generate_password(length);
printf("%s\n", password);
// We use malloc(), so you must free().free(password);
return0;
}
Performance
The library is quite fast. According to our benchmark...
$ make bench
$ ./bench
Ran on a Macbook Pro.
-> Benchmarking genpassword...
-> 3 runs, 100000 iterations each run, finished in 0.056893 seconds
-> 5273068.32 i/sec