0% found this document useful (0 votes)
16 views

Sankarshan Dahiya Student - Tracking Task 4 - Password Checker and Generator

The document outlines the requirements for a program that allows users to check the strength of passwords and generate strong passwords. The program will display a menu for users to select checking or generating a password. It will then evaluate passwords based on criteria like length and character types to determine a strength score and provide feedback.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

Sankarshan Dahiya Student - Tracking Task 4 - Password Checker and Generator

The document outlines the requirements for a program that allows users to check the strength of passwords and generate strong passwords. The program will display a menu for users to select checking or generating a password. It will then evaluate passwords based on criteria like length and character types to determine a strength score and provide feedback.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Password checker and Generator

A program needs to be created that allows the user to check the strength of
passwords and to generate strong passwords.
The program should check the strength of a password based on a point-scoring
system. When a password is entered, points are awarded based on the length of the
password and the types of characters contained within the password. Points are
deducted if characters are used in a limited way.

The program should also be able to generate a password that, when checked for
strength, is classified as a strong password.

The program should work in the following way:

Task 1
A menu is displayed allowing the user to select from the following options:
● Check Password
● Generate Password
● Quit.

Task 1 Code
Menu = int(input("1-Check_Password, 2-Generate_Password,
Anything_else_to_quit: "))
if Menu == 1:
Password1 = input("Ok, Checking Password...")
if Menu == 2:
Password2 = input("Ok, Generating Password...")
if Menu != 1 and Menu != 2:
print("Ok, Quitting Program")

Task 1 Output
Task 2
If the user selects the 'Check Password' option:
● they are asked to enter a password
● if the length of the entered password is less than 8 characters or greater than
24 characters then an appropriate error message is displayed and the user
returned to the menu
● the program checks that the password entered only contains allowed
characters.
● The allowed characters are:
i. upper case letters (A to Z)
ii. lower case letters (a to z)
iii. digits (0 to 9)
iv. allowed symbols (see Figure 1).
● If the password contains a character that is not allowed then an appropriate
error message is displayed and the user returned to the menu.
Task 2 Code

Task 2 Output

Task 3
A point score is calculated for the entered password. The score is set to the length of
the password. For example, if the password is 12 characters in length then the score
is set to 12.

Points are added for the following:


● if the password contains at least one upper case letter (A to Z) then 5 points
are added to the score
● if the password contains at least one lower case letter (a to z) then 5 points
are added to the score
● if the password contains at least one digit (0 to 9) then 5 points are added to
the score
● if the password contains at least one of the allowed symbols shown in Figure
1 then 5 points are added to the score
● if the password contains at least one upper case letter (A to Z) and at least
one lower case letter (a to z) and at least one digit (0 to 9) and at least one
allowed symbol shown in Figure 1, then an additional 10 points are added to
the score.

Points are subtracted for the following:


● if the password only contains upper and lower case letters (A to Z and a to z)
then 5 points are subtracted from the score
● if the password only contains digits (0 to 9) then 5 points are subtracted from
the score
● if the password only contains allowed symbols as shown in Figure 1 then 5
points are subtracted from the score
● if the password contains three consecutive letters based on the layout of a UK
QWERTY keyboard (see Figure 2) then 5 points are subtracted from the
score for each set of three.
Task 3 Code

Task 3 Output

Task 4
The point score is then used to determine if the password strength is weak, medium
or strong. If the point score is over 20 then the password is strong. If the point score
is zero or less then the password is weak. The password strength and the point
score should be displayed to the user. The user should then be returned to the
menu.

Task 4 Code
Task 4 Output

Task 5
If the user selects the 'Generate Password' option:
A. the program generates a random number between 8 and 12 inclusive. This
number will be the length of the password
B. the program then generates a random sequence of characters using letters,
digits and/or allowed symbols to create a password of the length set in A
C. the point score for the password is then calculated (in the same way as for a
user-entered password)
D. parts A to C should be repeated until the password strength is strong
E. the generated password and point score should then be displayed and the
user returned to the menu.

Task 5 Code

Task 5 Output

Task 6
If the user selects the 'Quit' option then a suitable message should be displayed and
the program ends.

Task 6 Code
Task 6 Output

The following examples show how the 'Check Password' option should work.

You might also like