问题
I want a password generator in Java, which should generate passwords with standard criteria like at least 8 characters long,contains one upper case letter, one special character etc.
It will great if it is open source.
Any suggestions / pointers ?
Thanks.
回答1:
If I where you, I would put all allowed characters in a char[]
and use SecureRandom to select n characters from this array.
Once done, you could add digits and special characters until it fits your needs.
来源:https://stackoverflow.com/questions/6493884/password-generator-in-java