Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Password generator in Java [duplicate]

Tags:

java

passwords

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.

like image 552
Ajinkya Avatar asked Jun 27 '11 13:06

Ajinkya


1 Answers

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.

like image 131
aioobe Avatar answered Oct 05 '22 18:10

aioobe