Proguard 7.1.1 string obfuscation fail

Hi Team,
I am new to proguard and want to obfuscate a string that is there in my jar. I tried using -adaptclassstrings com.package.Mycalss, but I can still see the plain Sting when I open the jar with JD-GUI only the name is changing to ‘a’. Is there a way where I can make the string gibberish such that the end-user can’t see the plain String?
Ex:
String string = “Hi”;
Expected obfuscated String string = “ajba1$1”; basically not the original string.
I tried it out using GUI but not sure if I am going in the right direction. Please help me out here.
Thanks in advance :slight_smile:

Dear @Raghunathbabu_Kotha ,

Welcome to our community and thanks a lot for reaching out to us! Good to hear that you are starting to use ProGuard.
Please let me further clarify what ProGuard can do for you:
ProGuard is an open-sourced Java class file shrinker, optimizer, obfuscator, and preverifier. As a result, ProGuard processed applications and libraries are smaller, faster, and somewhat hardened against reverse engineering.

  • The shrinking step detects and removes unused classes, fields, methods, and attributes.
  • The optimizer step optimizes bytecode and removes unused instructions.
  • The obfuscation step renames the remaining classes, fields, and methods using short meaningless names.
  • The final preverification step adds preverification information to the classes, which is required for Java Micro Edition and for Java 6 and higher.

This means that, in your example, ProGuard will be able to rename the name of the string:
Before obfuscation the code will look like:
String string = “Hi”;
After obfuscation, the code will look similar to the following:
String aIjde283 = “Hi";
So instead of encrypting the value of this string, ProGuard is able to obfuscate the name of the string.

I hope this helps you to understand why JD-GUI was showing you something else then what you originally expected to see.

Kind regards,

Ewout

1 Like

Hi, Ewout thank you for your quick reply.
I understand we can rename the variables. but can we also obfuscate the value “Hi”.

Dear @Raghunathbabu_Kotha ,

Sorry if that was not clear in my previous reply but since this is the value of the String and not the name, you cannot obfuscate it with ProGuard.

Kind regards,

Ewout