troubleshooting Question

password policy

Avatar of Aleks
AleksFlag for United States of America asked on
ASPWeb DevelopmentVB Script
8 Comments1 Solution135 ViewsLast Modified:
I am currently generating a random password with the code below. We are implementing a password policy and I need to change the script that generates the password to match this password policy.

This is the current script:

Function generatePassword( passwordLength )
    Dim sDefaultChars
    Dim iCounter
    Dim sMyPassword
    Dim iPickedChar
    Dim iDefaultCharactersLength
    Dim iPasswordLength

    sDefaultChars="abcdefghijklmnopqrstuvxyzABCDEFGHIJKLMNOPQRSTUVXYZ0123456789"
    iPasswordLength=passwordLength
    iDefaultCharactersLength = Len(sDefaultChars) 

    Randomize 'initialize the random number generator

    For iCounter = 1 To iPasswordLength
        'Next pick a number from 1 to length of character set 
        iPickedChar = Int((iDefaultCharactersLength * Rnd) + 1) 

        'Next pick a character from the character set using the random number iPickedChar and Mid function
        sMyPassword = sMyPassword & Mid(sDefaultChars,iPickedChar,1)
    Next 

    generatePassword = sMyPassword
End Function

Password policy:

Mininum:

- 1 Upper case Alphabet
- 3 lower case alphabet
- 2 numbers
- 1 special character    ~!@#$%^+-
ASKER CERTIFIED SOLUTION
aikimark
Get vaccinated; Social distance; Wear a mask

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Top Expert 2014

The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.

Join our community to see this answer!
Unlock 1 Answer and 8 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros