Question
A CERTAIN program to user's password containing rules such as least n length, one uppercase, lowercase, one digit and white space is given as the
A CERTAIN program to user's password containing rules such as least n length, one uppercase, lowercase, one digit and white space is given as the code down below. So, simiiar to those rules, I need the code for the following questions post in pictures such as no more three consecutive letters of English alphabets, password should not contain User name and so on.
//GOAL: To learn how to create that make strong passwords
//Purpose: 1)To learn some rules that makes strong passwords
// 2)To understand basic character function such as:
// 1)isalpha(), 2)isdigit(), 3)isalnum(), 4)islower()
// 5)isupper(), 6)ispunct(), 7)isprint(), 8)isspace(), 9)toupper(), 10)tolower()
// 3) To understand how to use basic string function such as:
// i)strlen(s1), ii)strcpy(s1,s2) like s1 = s2
// iii)strcat(s1,s2) concatenates s2 to the end of s1
// iv)strcmp(s1,s2) which returns the difference of the ASCII value of the first
// two non-matching characters in string s1 and s2.
#include
#include
#include
#define MAX_STRING_LENGTH 20
int main()
{
char s1[ MAX_STRING_LENGTH];
int n;
printf(" Please enter the string that you would like as your passwor:");
//scanf("%s",s1);
gets(s1);
printf(" The password you have chosen is: %s", s1);
printf(" What is the minimun length of a good/strong passwor:");
scanf("%d",&n);
if (strlen(s1)
{
printf(" Your password does not qualify, since it is not long enough!!");
printf("\ Your password if of length %d. Minimum password length is %d", strlen(s1),n);
}
else
{
printf(" You have chosen a good password. It meet the minimun length criterion.");
}
// Rule 2.
//..............................................................................................
int i;
int num_lower = 0;
int num_upper = 0;
int num_digit = 0;
for( i =0; i
{
if(isupper(s1[i]))
{
num_upper ++;
}
if (islower(s1[i]))
{
num_lower ++;
}
if (isdigit(s1[i]))
{
num_digit ++;
}
}
if (num_upper >0 && num_lower >0 && num_digit >0)
{
printf(" The password is Stong , because it has lowercase character, ");
printf(" Uppercase characters, and digit in the password.");
printf(" Your password is strong, since it meets the Rule 2:");
}
// Rule 3: Add a non-alphabetic character that is not a digit
//..........................................................
int num_special_character = 0;
for(i=0; i
{
if(! isalnum(s1[i]))
{
num_special_character ++;
}
}
if (num_special_character == 0)
{
printf("\ Your password is not good....");
printf("\ It is missing a special character, such as +-*/...etc.");
}
else
{
printf(" Your password is strong, since it meets the Rule 3:");
}
//Rule:4
//..................................
int num_whitespaces_total =0;
for( i=0; i
{
if(isspace(i))
{
printf(" %d %c is a white space", i,i);
num_whitespaces_total ++;
}
}
printf(" The 8-bit Extended ASCII code.... has %d WHITE SPACE CHARACTER", num_whitespaces_total);
int num_white_spaces =0;
for( i=0; i
{
if(isspace(s1(i)))
{
printf(" %d %c is a white space", i,i);
num_white_spaces ++;
}
}
if (num_white_spaces == 0)
{
printf(" Your password is bad:");
}
else
{
printf("It good password:");
}
getchar();
return 0;
}
Develop a code for C program to make sure that your program has the following rules. Add the following rule: The password should not contain any word from the dictionary You may use your dictionary from Assignment Add the following rule: Your password should not contain three or more consecutive letters of the English al also disallow 3 consecutive digits. e.g. "abcd1234temp" would be considered a bad password. phabet". You should Add the following rule: "Your password should not contain three or more consecutive letters of the English alphabet that are adjacent keys on the keyboard". You should also disallow 3 consecutive digits. e.g.. "qwerty 123asdfg" would be considered a bad password. Your password should not contain the User name. No three consecutive letters of the User name should be allowed in the password. e.g.. Username: Mike Password: Mike23vnkdtrp8 should not be allowed. Write a short note on the difficulties you encountered in implementing your password checker program above. Explain how you overcame those difficulties. How strong is your password? Explain briefly. State (but not implement) any 2 additional criteria for an even stronger password. How hard would they be to implement? ExplainStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started