I'm working on a random password generator to create passwords that meet certain conditions including, but not necessarily limited to:
What would be the best algorithmic approach to ensure that the generated password meets all these?
I'm not looking for a complete solution, I only need a few good ideas and guidelines.
Long: The longer a password, the more secure it is. A strong password should be at least 12 characters long. Random: Strong passwords use a combination of letters, numbers, cases, and symbols to form an unpredictable string of characters that doesn't resemble words or names.
LastPass offers a powerful, secure password generator that's 100% free and backed by a range of additional features. It's available both online through the LastPass website and within the LastPass app. With it, you can specify exactly what sort of password you want to create.
1) randomly generate number L which will be the exact length of your password. Namely, generate is so that it is greater than 8
2) randomly generate a number LL which will be the number of lowercase letters. LC must be in range [1..L-2]
3) randomly generate number LU for uppercase. Must be in range [1..L-LL-1]
4) LD = L-LL-LU number of uppercase digits
5) randomly generate LL lowercase letters, LU uppercase letters, and LD digits and keep them in a list(array)
6) Shuffle the array randomly
hth
The algorithm should usually succeed on the first few iterations, and saves you from having to implement a shuffle algorithm.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With