Mr Travi Royal Grammar School No 1 The basic requirements Input a password 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 Check each character of the password in turn 1) 2) 3) 4) 5) 6) 7) 8) 9) 10) 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 If 1 different character type is used then the password status is set to weak i.e. if lower characters are greater than 1 and upper , numeric and punctuation characters are less than If 2 different character types are used then the password status is set to medium If 3 different character types are used then the password status is set to strong If 4 different character types are used then the password status is set to extra strong List of passwords are stored in an array and results showing whether weak, medium, strong or extra strong are displayed in a spreadsheet Select a password to amend and change it 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 yes Is it greater than 12 characters No Flow chart of the program Output password OK and write to spreadsheet file Is the character lcase or lowercase ? lowers = lowers +1 yes No Set Counter, uppers, lowers, numerics Puncts to Zero Yes Uppers= Uppers+1 Is the character ucase or Uppercase ? No For each character in password Yes Numbers = Numbers + 1 Is the character Numeric ? No Is the character not lcase or ucase or numeric? Yes Punct = punct +1 No All characters checked? Password status = uppers, l+ owers, numerics + Puncts Output password strength and write to file Stop REPEAT INPUT the password len=length of password IF len <6 OR len >12 THEN PRINT suitable error message UNTIL len >=6 and <=12 PRINT password OK Initialise upper, lower, puncts and number to 0 FOR i = 1 TO len For Counter = 1 To Len(ValidPassword(howmanypasswords)) Select Case Asc(Mid(ValidPassword(howmanypasswords), Counter, 1)) Case 47 To 57 numerics = numerics + 1 Case 65 To 90 uppers = uppers + 1 Case 97 To 122 lowers = lowers + 1 Case Else puncts = puncts + 1 End Select Next Counter If uppers > 0 And lowers > 0 And puncts > 0 And numerics > 0 Then passwordstatus = "Extra Strong" ElseIf uppers > 0 And lowers > 0 And numerics > 0 Then passwordstatus = "Strong" ElseIf alphas > 0 And (puncts > 0 Or numerics > 0) Then passwordstatus = "Medium" ElseIf uppers > 0 And lowers > 0 Then passwordstatus = "Medium“ Else passwordstatus = "Weak“ Endif 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 and Extra Strong identified: Weak Medium Strong Extra Strong mrtravi MRTRAVI 123456 MrTravi Awerty Zwerty 3werty 3WERTY Q23456 qwe456 1w3r5y QW345Y QW34ty 12erTY MrT:O521542 01mL;*&EWa All lower / upper case/ numeric: weak reported 1 upper case, rest lower, also test A and Z accepted Medium reported All medium strength combinations and With differing quantities of numbers and letters Both cases and numeric used, Strong reported All lower / upper case/ numeric/ punct: Main program Set up variables Validpasswords() 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 has Txtinput – 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 enter I 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 into Lblstrength 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 characters All 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 strong The 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. Testing Section Test Data Expected Actual / Comment To 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 Test Data Expected Actual / Comment To 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:O521542 and highlight password status MrT:O521542 is displayed as extra strong Test Data Expected Actual / Comment To 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 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 2 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