promolooki.blogg.se

Coding a strong password generator
Coding a strong password generator













coding a strong password generator

This.maxSize = PasswordGenerator.DefaultMaximum This.minSize = PasswordGenerator.DefaultMinimum StringBuilder pwdBuffer = new StringBuilder() Int pwdLength = GetCryptographicRandomNumber(this.Minimum, Pick random length between minimum and maximum PwdCharArray.GetLowerBound(0), upperBound) Ĭhar randomChar = pwdCharArray Int randomCharPosition = GetCryptographicRandomNumber( UpperBound = PasswordGenerator.UBoundDigit Int upperBound = pwdCharArray.GetUpperBound(0) Return (int)(urndnum % (uBound-lBound)) + lBound Assumes lBound >= 0 & lBound = lBound and = xcludeRndBase) Protected int GetCryptographicRandomNumber(int lBound, int uBound)

#Coding a strong password generator generator#

You would need to create a pattern that matches the minimum character/number requirements for a valid password, add logic to vary the length of the generated password by adding in random characters, and perhaps add some random sort logic at the end to mix the characters up so that they are not always in the same pattern.ĮDIT(2): Moved the code to GitHub, updated links.ĮDIT(3): Linked to main Github repo instead.Ī C# Password Generator namespace Its not exactly what you are looking for but you should be able to modify it to suit your needs.ĮDIT: Reading through your requirements again I think you should be able to alter my code to get it to work. * - An upper-case or lower-case letter or number.You provide it with a pattern which you want to generate and it will create random data to match that pattern. I wrote a simple Data generation library ages ago to mock up some data we needed, you could take a look at that to get some ideas.















Coding a strong password generator