Password generator in Java [duplicate]

2019-06-21 05:49发布

This question already has an answer here:

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条回答
倾城 Initia
2楼-- · 2019-06-21 06:27

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.

查看更多
登录 后发表回答