|
@@ -7,17 +7,17 @@ import java.util.Random;
|
|
|
public class PasswordGenerator {
|
|
|
public static final String[] SOURCE = {"abcdefghijklmnopqrstuvwxyz", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "0123456789", "!@#$%^&*()_+,.<>/?{}[]"};
|
|
|
|
|
|
-// public static void main(String[] args) throws Exception {
|
|
|
-// List<Integer> usedSourceIndexes = new ArrayList<>();
|
|
|
-// int passwordLength = 16;
|
|
|
-// String password;
|
|
|
-// for (int i = 0; i < passwordLength; i++) {
|
|
|
-// do {
|
|
|
-// password = generatePassword(usedSourceIndexes, passwordLength);
|
|
|
-// } while (usedSourceIndexes.size() < SOURCE.length);
|
|
|
-// System.out.println(password);
|
|
|
-// }
|
|
|
-// }
|
|
|
+ public static void main(String[] args) throws Exception {
|
|
|
+ List<Integer> usedSourceIndexes = new ArrayList<>();
|
|
|
+ int passwordLength = 16;
|
|
|
+ String password;
|
|
|
+ for (int i = 0; i < passwordLength; i++) {
|
|
|
+ do {
|
|
|
+ password = generatePassword(usedSourceIndexes, passwordLength);
|
|
|
+ } while (usedSourceIndexes.size() < SOURCE.length);
|
|
|
+ System.out.println(password);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
public static String generatePassword(List<Integer> usedSourceIndexes, int passwordLength) {
|
|
|
usedSourceIndexes.clear();
|