HistoryPurge: Clearing 219 old commits

This commit is contained in:
xpk
2024-10-24 23:09:21 +08:00
commit d08b7cac59
348 changed files with 376141 additions and 0 deletions
Binary file not shown.
@@ -0,0 +1,55 @@
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.util.ArrayList;
import java.util.List;
class PasswordGenerator {
private static final int DEFAULT_PASSWORD_LENGTH = 3;
public static void main(String[] args) {
try {
List<String> dictionary = loadDictionary(args[0]);
String password = generatePassword(dictionary, DEFAULT_PASSWORD_LENGTH);
System.out.println(password.replaceAll("o", "0"));
} catch (IOException e) {
System.err.println("Failed to load dictionary file: " + e.getMessage());
}
}
private static List<String> loadDictionary(String filename) throws IOException {
List<String> dictionary = new ArrayList<>();
try (BufferedReader br = new BufferedReader(new FileReader(filename))) {
String line;
while ((line = br.readLine()) != null) {
dictionary.add(line.trim());
}
}
return dictionary;
}
private static String generatePassword(List<String> dictionary, int length) {
StringBuilder passwordBuilder = new StringBuilder();
SecureRandom random;
try {
random = SecureRandom.getInstanceStrong();
} catch (NoSuchAlgorithmException e) {
random = new SecureRandom();
}
for (int i = 0; i < length; i++) {
int randomIndex = random.nextInt(dictionary.size());
String word = dictionary.get(randomIndex);
passwordBuilder.append(toCamelCase(word));
if ( i < length-1) {
passwordBuilder.append("+");
}
}
return passwordBuilder.toString();
}
private static String toCamelCase(String inputString) {
return inputString.substring(0,1).toUpperCase() + inputString.substring(1).toLowerCase();
}
}
+26
View File
@@ -0,0 +1,26 @@
apple
banana
carrot
dog
elephant
flower
green
happiness
icecream
jungle
kangaroo
lemon
monkey
notebook
orange
pineapple
queen
rabbit
sunshine
tiger
umbrella
victory
watermelon
xylophone
yellow
zebra
File diff suppressed because it is too large Load Diff
Binary file not shown.