public StringEncryption getStringEncryption() { if (stringEncryptionEnabledCheckBox.isSelected()) { StringEncryptionSetup setup = new StringEncryptionSetup(stringExclusions); StringEncryption encryptionTransformer; switch (stringEncryptionTypeSelector.getSelectedIndex()) { case 0: { encryptionTransformer = new LightStringEncryption(setup); break; } case 1: { encryptionTransformer = new NormalStringEncryption(setup); break; } case 2: { encryptionTransformer = new HeavyStringEncryption(setup); break; } default: { throw new IllegalStateException(String.format("Bad string encryption type %d.", stringEncryptionTypeSelector.getSelectedIndex())); } } return encryptionTransformer; } else { return null; } }
MemberNames memberNames = new MemberNames(); getClassWrappers().parallelStream().filter(classWrapper -> !excluded(classWrapper)).forEach(classWrapper -> classWrapper.methods.parallelStream().filter(methodWrapper -> !excluded(methodWrapper) && hasInstructions(methodWrapper.methodNode)).forEach(methodWrapper -> { MethodNode methodNode = methodWrapper.methodNode; int leeway = getSizeLeeway(methodNode); String cst = (String) ldc.cst; if (!excludedString(cst)) { int extraKey = RandomUtils.getRandomInt(); int callerClassHC = classWrapper.classNode.name.replace("/", ".").hashCode(); int decryptorClassHC = memberNames.className.replace("/", ".").hashCode(); int decryptorMethodHC = memberNames.decryptorMethodName.hashCode(); ldc.cst = encrypt(cst, callerClassHC, callerMethodHC, decryptorClassHC, decryptorMethodHC, extraKey); methodNode.instructions.insert(insn, new MethodInsnNode(INVOKESTATIC, ClassNode decryptor = createDecryptor(memberNames); getClasses().put(decryptor.name, new ClassWrapper(decryptor, false));
public static StringEncryption getTransformerFromString(String s, StringEncryptionSetup setup) { switch (s.toLowerCase()) { case "light": { return new LightStringEncryption(setup); } case "normal": { return new NormalStringEncryption(setup); } case "heavy": { return new HeavyStringEncryption(setup); } default: { throw new IllegalConfigurationValueException("Did not expect " + s + " as a string obfuscation mode"); } } } }