A random password generator is software
program or hardware device that takes input from a random or pseudo-random number generator and automatically generates a password. Random
passwords can be
generated manually, using simple sources of randomness such as dice or coins,
or they can be generated using a computer software program.
Here we have a
simple program by using it you can generate a strong password of any predefined
length. As you increase the length of password, it becomes stronger.
//Source Code:
#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <time.h>
int main()
{
int counter = 0;
srand(time(NULL)); // seeding function for random()
char randChar;
int passwordLength;
printf("****A Random Password
Generator****\n\n");
printf("Type password Length:
");
scanf("%d", &passwordLength);
printf("\n\n");
while (counter <
passwordLength)
{
//Get a random char among 70
characters
randChar
= "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789@#$%^&*!"[rand() % 70];
printf("%c", randChar);
counter++;
}
printf("\n");
_getch();
return 0;
}
Output: