|
|
@@ -9,7 +9,7 @@ public class RandomPasswordGenerator {
|
|
|
private static final String UPPER_CASE = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|
|
private static final String NUMBERS = "0123456789";
|
|
|
private static final String SPECIAL_CHARACTERS = "!@#$%^&*()_+-=[]{}|;:,.<>?";
|
|
|
- private static final String ALL_CHARACTERS = LOWER_CASE + UPPER_CASE + NUMBERS + SPECIAL_CHARACTERS;
|
|
|
+ private static final String ALL_CHARACTERS = LOWER_CASE + UPPER_CASE + NUMBERS;
|
|
|
private static final SecureRandom RANDOM = new SecureRandom();
|
|
|
|
|
|
public static String generatePassword(int length) {
|
|
|
@@ -24,11 +24,11 @@ public class RandomPasswordGenerator {
|
|
|
password.append(getRandomChar(LOWER_CASE));
|
|
|
password.append(getRandomChar(UPPER_CASE));
|
|
|
password.append(getRandomChar(NUMBERS));
|
|
|
- password.append(getRandomChar(SPECIAL_CHARACTERS));
|
|
|
+// password.append(getRandomChar(SPECIAL_CHARACTERS));
|
|
|
charSet.add(LOWER_CASE.charAt(0)); // 示例,实际应从生成的字符中添加到集合中
|
|
|
charSet.add(UPPER_CASE.charAt(0)); // 示例,实际应从生成的字符中添加到集合中
|
|
|
charSet.add(NUMBERS.charAt(0)); // 示例,实际应从生成的字符中添加到集合中
|
|
|
- charSet.add(SPECIAL_CHARACTERS.charAt(0)); // 示例,实际应从生成的字符中添加到集合中
|
|
|
+// charSet.add(SPECIAL_CHARACTERS.charAt(0)); // 示例,实际应从生成的字符中添加到集合中
|
|
|
|
|
|
// 填充剩余的字符直到达到所需长度
|
|
|
while (password.length() < length) {
|