What would be a smart ProGuard configuration to obfuscate just the private methods and constants of one particular class com.acme.Algorithm?
I would like to obfuscate just that, because it contains an algorithm that should not be plain obvious when accidentally opening the .jar.
I'm a ProGuard newbie. AFAIU, you have to use "keep", but the positive logic of "do obfuscate" is not available, right? So how to exlude my class from a "keep everything" config? Note: I don't want to obfuscate other classes for the moment, because I want to allow the customer to see meaningful stacktraces.
-keepclassmembernames. This is the most permissive keep directive; it lets ProGuard do almost all of its work. Unused classes are removed, the remaining classes are renamed, unused members of those classes are removed, but then the remaining members keep their original names.
In the obfuscation step, ProGuard renames classes and class members that are not entry points. In this entire process, keeping the entry points ensures that they can still be accessed by their original names. The preverification step is the only step that doesn't have to know the entry points.
Obfuscating package names myapplication. MyMain is the main application class that is kept by the configuration. All other class names can be obfuscated. Note that not all levels of obfuscation of package names may be acceptable for all code.
Resource [Tutorial] How to obfuscate a plugin using ProGuard 1 Add your plugin, the file the obfuscated plugin should be saved to and the dependencies (also the spigot api / the... 2 Disable shrinking and optimization. 3 Enable "Obfuscation Dictionary", "Class obfuscation dictionary", "Package obfuscation dictionary" and use a... More ...
As I've written before in Java decompilers and obfuscators, if you're sharing a Java application with other people, and you don't want them to be able to easily decompile your Java class files, you're going to want to obfuscate your Java class files. One way to obfuscate your class files is with a tool named ProGuard.
What is Proguard? ProGuard is a free Java tool in Android that performs three major roles: 1. Shrink/minify the code (remove unused code in the project)
Yes but obfuscating stops the majority of people from accessing your code, Plus for a good obfuscare it would tkae tens if not hundereds of hours to crack as a user once tried to crack EWG and gave up after about 15 hours of trying. As a User, Does this not require more load on my Server to use your plugin? Click to expand... 1.
Obfuscating a single class won't have much effect: it may change the class name and a few field names and methods names, and it may optimize some code. Obfuscation tends to be less effective for hiding small pieces of information. The more application code you obfuscate, the more difficult it becomes to understand.
That being said, you can specify:
-keep class !com.acme.Algorithm { *; }
It keeps all classes/fields/methods outside of com.acme.Algorithm.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With