Ramdom Password
Ramdom Password
BY
NAME MATRIC. NO
#include <stdlib.h>
#include <time.h>
#include <stdbool.h>
#include <string.h>
#include <ctype.h>
#define MIN_LENGTH 6
#define MAX_LENGTH 64
// Character sets
void generate_password(int length, bool use_lower, bool use_upper, bool use_digits, bool use_symbols)
{
return;
return;
if (use_lower) {
strcat(pool, lowercase);
pool_size += strlen(lowercase);
if (use_upper) {
strcat(pool, uppercase);
pool_size += strlen(uppercase);
if (use_digits) {
strcat(pool, digits);
pool_size += strlen(digits);
if (use_symbols) {
strcat(pool, symbols);
pool_size += strlen(symbols);
// Generate password
password[i] = pool[index];
}
void print_help() {
printf("Usage:\n");
printf(" Enter desired password length (between %d and %d)\n", MIN_LENGTH, MAX_LENGTH);
int main() {
srand(time(NULL));
int length;
char input[10];
print_help();
length = atoi(input);
} else {
length = 0;
}
// Get character set options
use_lower = true;
use_upper = true;
use_digits = true;
use_symbols = true;
return 0;
}
Input
Output