mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-23 09:01:08 +03:00
[FEATURE] Алгоритм генерации словаря ProGuard на основе projectName
This commit is contained in:
parent
367993daf0
commit
1cc727239d
1 changed files with 10 additions and 4 deletions
|
@ -16,9 +16,12 @@ public class ProguardConf {
|
||||||
private static final String charsFirst = "aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ";
|
private static final String charsFirst = "aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ";
|
||||||
private static final String chars = "1aAbBcC2dDeEfF3gGhHiI4jJkKl5mMnNoO6pPqQrR7sStT8uUvV9wWxX0yYzZ";
|
private static final String chars = "1aAbBcC2dDeEfF3gGhHiI4jJkKl5mMnNoO6pPqQrR7sStT8uUvV9wWxX0yYzZ";
|
||||||
|
|
||||||
private static String generateString(SecureRandom rand, int il) {
|
private static String generateString(SecureRandom rand, String lowString, String upString, int il) {
|
||||||
StringBuilder sb = new StringBuilder(il);
|
StringBuilder sb = new StringBuilder(il + lowString.length());
|
||||||
sb.append(charsFirst.charAt(rand.nextInt(charsFirst.length())));
|
for(int i = 0;i<lowString.length();++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())));
|
for (int i = 0; i < il - 1; i++) sb.append(chars.charAt(rand.nextInt(chars.length())));
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
@ -66,7 +69,10 @@ public void genWords(boolean force) throws IOException {
|
||||||
SecureRandom rand = SecurityHelper.newRandom();
|
SecureRandom rand = SecurityHelper.newRandom();
|
||||||
rand.setSeed(SecureRandom.getSeed(32));
|
rand.setSeed(SecureRandom.getSeed(32));
|
||||||
try (PrintWriter out = new PrintWriter(new OutputStreamWriter(IOHelper.newOutput(words), IOHelper.UNICODE_CHARSET))) {
|
try (PrintWriter out = new PrintWriter(new OutputStreamWriter(IOHelper.newOutput(words), IOHelper.UNICODE_CHARSET))) {
|
||||||
for (int i = 0; i < Short.MAX_VALUE; i++) out.println(generateString(rand, 24));
|
String projectName = LaunchServer.server.config.projectName.replaceAll("\\W", "");
|
||||||
|
String lowName = projectName.toLowerCase();
|
||||||
|
String upName = projectName.toUpperCase();
|
||||||
|
for (int i = 0; i < Short.MAX_VALUE; i++) out.println(generateString(rand, lowName, upName, 3));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue