'Creator: Jaze C McAskill
PRINT "Special characters? ";
characterSet$ = "" 'define the list of characters from which to make the password
FOR upperLower
= 65 TO 64 + 26 characterSet$
= characterSet$
+ CHR$(upperLower
) 'add upper case letters characterSet$
= characterSet$
+ CHR$(upperLower
+ (96 - 64)) 'add lower case letters
FOR integers
= 48 TO 48 + 9 characterSet$
= characterSet$
+ CHR$(integers
) 'add numbers
IF specialCharsYN$
= "Y" THEN 'get special characters from user PRINT "Type in character set to use, <ENTER> to stop." another$ = ""
characterSet$ = characterSet$ + another$ 'add provided special characters
INPUT "Password length: "; pwlength
makePwAgain: 'place to return to if the password is missing an upper case, lower case, integer or special character
pw$ = "": newChar$ = ""
FOR pickAcharFromCharacterSet
= 1 TO pwlength
'loop from 1 to the length of the password to be generated newChar$
= MID$(characterSet$
, INT(RND * LEN(characterSet$
) + 1), 1) 'pick a new character from the predefined set pw$ = pw$ + newChar$ 'add it to the password
intInPw = FALSE ' used to make sure and integer is in the password
upperCaseInPw = FALSE ' same for upper case
lowerCaseInPw = FALSE ' lower case
specialCharInPw = FALSE ' special character
'the specialChar checking is the one I can't see yet
FOR parsing
= 1 TO LEN(pw$
) 'check each character in the generated password to make sure one of each is there upperCaseInPw = TRUE
lowerCaseInPw = TRUE
intInPw = TRUE
'program knows if pw$ has an int, an upper case and a lower case
IF specialCharsYN$
= "Y" THEN 'check to make sure a special character was added FOR parsing
= (26 * 2 + 10) + 1 TO LEN(characterSet$
) 'skip the uppercase, lowercase and integers in the set from wich the password is made ifThisCharIsInPW$
= MID$(characterSet$
, parsing
, 1) ' cycle throgh the special characters IF MID$(pw$
, parsing2
, 1) = ifThisCharIsInPW$
THEN specialCharInPw
= TRUE
specialCharInPw = TRUE
IF intInPw
= FALSE
OR upperCaseInPw
= FALSE
OR lowerCaseInPw
= FALSE
OR specialCharInPw
= FALSE
THEN GOTO makePwAgain