Date post: | 27-Dec-2015 |
Category: |
Documents |
Upload: | phoebe-boone |
View: | 214 times |
Download: | 1 times |
Mr TraviRoyal Grammar School
No 1
The basic requirements1) Input a password 2) Is the password between 6 and 12 characters long
No reject and return to Stage 1 Yes output message and write the password to the spreadsheet file
3) Check each character of the password in turn Is the character lower case if yes add 1 to the lower character counter Is the character upper case if yes add 1 to the upper character counter Is the character a number if yes add 1 to the numeric character counter Is the character non numeric or text if yes add 1 to the punctuation character
counter
4) If 1 different character type is used then the password status is set to weaki.e. if lower characters are greater than 1 and upper , numeric and punctuation characters are less than
5) If 2 different character types are used then the password status is set to medium
6) If 3 different character types are used then the password status is set to strong
7) If 4 different character types are used then the password status is set to extra strong
8) List of passwords are stored in an array and results showing whether weak, medium, strong or extra strong are displayed in a spreadsheet
9) Select a password to amend and change it10) Search a password from within the array and replace it
Flow chart of the program
Start
Input a password
Is it greater than 6 characters
NoIs it greater than 6 characters
Is it greater than 12 characters
yes
Flow chart of the program
Output password OK and write to spreadsheet file
Set Counter, uppers, lowers, numerics Puncts to Zero
For each character in password
Is the character lcase or lowercase ?
lowers = lowers +1 yes
No
Is the character ucase or Uppercase ?
Uppers= Uppers+1 Yes
Is the character Numeric ?
Numbers = Numbers + 1
Yes
Is the character not lcase or ucase or numeric?
Punct = punct + 1
No
No
Yes
All characters checked?
No
Password status = uppers, l+ owers, numerics + Puncts
Output password strength and write to file
REPEATINPUT the passwordlen=length of passwordIF len <6 OR len >12 THEN PRINT suitable error messageUNTIL len >=6 and <=12PRINT password OKInitialise upper, lower, puncts and number to 0FOR i = 1 TO lenFor Counter = 1 To Len(ValidPassword(howmanypasswords))Select Case Asc(Mid(ValidPassword(howmanypasswords), Counter, 1))Case 47 To 57numerics = numerics + 1Case 65 To 90uppers = uppers + 1Case 97 To 122lowers = lowers + 1Case Elsepuncts = puncts + 1End SelectNext CounterIf uppers > 0 And lowers > 0 And puncts > 0 And numerics > 0 Thenpasswordstatus = "Extra Strong"ElseIf uppers > 0 And lowers > 0 And numerics > 0 Thenpasswordstatus = "Strong"ElseIf alphas > 0 And (puncts > 0 Or numerics > 0) Thenpasswordstatus = "Medium"ElseIf uppers > 0 And lowers > 0 Thenpasswordstatus = "Medium“Elsepasswordstatus = "Weak“Endif
Stop
We need a test strategy to use during development to show that the solution works at each stage. Requirement: 6- 12 characters
Less than 6 6 exactly >6 and <12
12 exactly More than 12
MrTra MrTrav MrTravi MrTravirocks MrTraviuiopasd
5 characters should be rejected
6 characters, boundary, should be OK
7 characters, valid input should be OK
12 characters, boundary, should be OK
13 characters should be rejected
Weak Medium Strong
Extra Strong
mrtraviMRTRAVI123456
MrTravi AwertyZwerty
3werty3WERTYQ23456qwe4561w3r5yQW345Y
QW34ty12erTY
MrT:O52154201mL;*&EWa
All lower / upper case/ numeric:weak reported
1 upper case, rest lower, also test A and Z acceptedMedium reported
All medium strength combinations andWith differing quantities of numbers and letters
Both cases and numeric used, Strong reported
All lower / upper case/ numeric/ punct:
Weak, Medium, Strong and Extra Strong identified:
Main program
Set up variablesValidpasswords() is an array where the passwords entered by the user and written after they have passed a length test. This is a dynamic array and the results of this are written to the spreadsheet file Password status records the results of the processing of the program to determine whether the password is weak, medium, strong or extra strong User Interface
The user interface hasTxtinput – a textbox to allow the user to enter the password. In the properties I have set the passwordchar property to * to mimic the entry of passwords The sub here updates each time a character is entered and outputs the number of characters that the password contains and what the status of the password being entered. For example
This shows what happens when just 2 characters have been entered the message displays ‘too short
Here 7 characters have been entered and the password length is OK
Here 14 characters have been entered and the password length is too long
The user interface has a label where the length of the password is displayed and the status of the password as it is enterI have used several command buttons
CmdOk executes the main part of the program CmdStartAgain will allow the user to reinitiate the program and toe enter the password again CmdBonnet allows the user to say statistics about the password that has been entered, how lcase, ucase, mumeric and punctuation characters have been uesd CmdBack makes the cmdbonnet visuble and lblstatus.visible property set to false
Lblstatus – 0nce the password has been accepted as valid the lblstatus label is set to visible and the password is displayed over the top of the text box where the password was entered intoLblstrength the password status is displayed in this label.
I have entered a 5 character password and pressed CMDOk and invalid password has been returned
This initialises the array to make the array value equal to the number of passwords entered + 1
I have enclosed here with the program some main pseudocode. Msgbox txtinput.text displays a message and can help in the testing process
The sub accumulator can only run if the function which I have created lengthOk is true. Within the function there are 2 locally defined variables atLeast6long and max12long which have to be true for the function I have created to be true
The accumulator module
This sub checks how many of each type of character appear in the password. The character is converted into its ASCII value 47 – 57 – numeric characters 65- 90 – lower case characters 97 – 122 Upper case charactersAll other ASCII characters are counted as punctuation marks
The sub calculates the value of the character for each password and adds up the total number of lower, upper, numerical and punctuation characters.
The password strength is processed using a nested if statement to work out if the password is weak, medium, strong or extra strongThe results of the program are written to the lblbonnet,caption and written to the sheet
This part of the sub writes the numbers of lowers, uppers, numeric and puncts to the sheets and the status result is written there
Howmanypasswords is a function created using a function with the spreadsheet and courting up how many entries are recorded in column A when the results of the program are being processed and written to
When the form is activated the sub init is initialised
This sets up the initial values and loads them into the variables
This loads the passwords into the array and writes the password to the spreadsheet file. The counter is set to the number of passwords already stored in the array.
This sub searches through the array to see if a password is in the array and then displays it.
Test Data Expected Actual / CommentTo see what happens when there are less than 6 characters
mrtra Should be rejected Was rejected
To see what happens if 6 characters are used
mrtrav Should be accepted and processed as weak
Accepted and processed as weak
To see what happens when 7 characters are used
mrtravi Should be accepted and processed as weak
Accepted and processed as weak
Testing Section
Test Data Expected Actual / CommentTo see what happens when all numeric characters are used
521423 Should be accepted and status should be processed as weak
Was accepted and processed as weak
To see what happens if 7 characters including a capital letter are used
Mrtravi Should be accepted and processed as medium
Accepted and processed as medium
To see what happens when a number and capital letters are used
3WERTY Should be accepted and processed as medium
Accepted and processed as medium
Testing Section
To see what happens when a combination of lower case , uppercase and numeric characters are used
QW34ty Should be accepted as strong
Accepted and processed as strong
To see what happens when a combination of lower , upper case, numerical and punctuation characters are used
MrT:O521542
Should be accepted and processed as extra strong
Accepted and processed as extra strong
To perform a search through the array holding the passwords records
Record 2 Should display the password MrT:O521542and highlight password status
MrT:O521542is displayed as extra strong
Test Data Expected Actual / CommentTo change a password held in the array
mrtravi To change mrtravi to mrtravirocks
Password was changed
Test 1 I have entered mrtra as a password with 5 characters this has been rejected
Test 2
I have entered mrtrav as a password with 6 characters this has been accepted and the status accepted as weak as this used all lower case characters
Test 3
This shows that the password has been accepted and written to the spreadsheet Test 4
The counts all the numeric characters and processes the password status as weak
Test 5
Here 1 capital letter and 6 lower case letters have been used and the password status has been processed as medium as expected Test 6
This combination of uppercase letters and numbers has returned a medium password classification
Test 7
I have used here a combination of 2 uppercase, 2 lowercase letters and 2 numerical characters and this has returned a strong password
Test 8
I have used a combination of 2 uppercase, 2 lowercase letters, numerical and punctuation characters which as returned an extra strong password
Test 9
Test 10 First has to search for record mrtravi
Record located
Password has been successfully searched and amended