mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-11-15 11:39:11 +03:00
[FIX] Генерация словаря учитывает размер projectName
This commit is contained in:
parent
dbc7fa36e7
commit
cf18ce6110
1 changed files with 4 additions and 3 deletions
|
@ -19,11 +19,12 @@ public class ProguardConf {
|
||||||
private static final String chars = "1aAbBcC2dDeEfF3gGhHiI4jJkKl5mMnNoO6pPqQrR7sStT8uUvV9wWxX0yYzZ";
|
private static final String chars = "1aAbBcC2dDeEfF3gGhHiI4jJkKl5mMnNoO6pPqQrR7sStT8uUvV9wWxX0yYzZ";
|
||||||
|
|
||||||
private static String generateString(SecureRandom rand, String lowString, String upString, int il) {
|
private static String generateString(SecureRandom rand, String lowString, String upString, int il) {
|
||||||
StringBuilder sb = new StringBuilder(il + lowString.length());
|
StringBuilder sb = new StringBuilder(Math.max(il, lowString.length()));
|
||||||
for (int i = 0; i < lowString.length(); ++i) {
|
for (int i = 0; i < lowString.length(); ++i) {
|
||||||
sb.append(rand.nextBoolean() ? lowString.charAt(i) : upString.charAt(i));
|
sb.append(rand.nextBoolean() ? lowString.charAt(i) : upString.charAt(i));
|
||||||
}
|
}
|
||||||
for (int i = 0; i < il - 1; i++) sb.append(chars.charAt(rand.nextInt(chars.length())));
|
int toI = il - lowString.length();
|
||||||
|
for (int i = 0; i < toI; i++) sb.append(chars.charAt(rand.nextInt(chars.length())));
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,7 +75,7 @@ public void genWords(boolean force) throws IOException {
|
||||||
String projectName = srv.config.projectName.replaceAll("\\W", "");
|
String projectName = srv.config.projectName.replaceAll("\\W", "");
|
||||||
String lowName = projectName.toLowerCase();
|
String lowName = projectName.toLowerCase();
|
||||||
String upName = projectName.toUpperCase();
|
String upName = projectName.toUpperCase();
|
||||||
for (int i = 0; i < Short.MAX_VALUE; i++) out.println(generateString(rand, lowName, upName, 3));
|
for (int i = 0; i < Short.MAX_VALUE; i++) out.println(generateString(rand, lowName, upName, 14));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue