A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/brendanashworth/genpassword.c below:

brendanashworth/genpassword.c: Random password generating library, in C

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(int length);

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 of this library is accomplished via CLib.

$ clib install boboman13/genpassword.c

This will give you a deps folder with the library.

#include <stdio.h>
#include <time.h>
#include "deps/genpassword.c/genpassword.c"

int main() {
	// This is where we seed.
	srand(time(NULL));

	int length = 10;
	char *password = generate_password(length);

	printf("%s\n", password);

	// We use malloc(), so you must free().
	free(password);
	return 0;
}

The library is quite fast. According to our benchmark...

Ran on a Macbook Pro.

 -> Benchmarking genpassword...
 -> 3 runs, 100000 iterations each run, finished in 0.056893 seconds
 -> 5273068.32 i/sec

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4