Password generator in Java [duplicate]

跟風遠走 提交于 2019-12-10 13:45:58

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!