17

Is there a simple description of how the dictionary file in Proguard should be structured?

I've read about -?obfuscationdictionary, but I couldn't find anything about the files themselves.

Besides, I'd like to change the naming scheme to something more complex, and not just a, b etc. and paramX, paramY... I'd like a random series of characters, if possible.

And yes, I know it's just a visual difference that can be remodeled (refactored?) to something easier to read. Still, just asking...

Thanks

2 Answers 2

28

The dictionary file format is pretty simple:

  1. One word per line
  2. Blank lines ignored
  3. Lines starting with # ignored

If you want to create a dictionary of random strings, you could write a simple program to generate them and dump them to a text file, or use http://www.random.org/strings which has a nice simple web interface for creating random strings. It spits them out one per line, so you could use its output directly as your dictionary file.

Here's some sample output (you can generate strings of any size):

HISPj7KHQ7
Wja3o2vx62
eyd3OXAZgV
DxDJysLV5r
BsUTWEAMAI
R7N8DF4OVS
4q7UsoAgP4
cWbN6pumKk
SJowARcXwM
OyIbF7L6XB

Here's an example I found:

https://trac.openxdata.org/browser/trunk/j2me/openxdata-mobile/epihandy-lite/proguard/examples/dictionaries/keywords.txt?rev=1156

#
# This obfuscation dictionary contains reserved Java keywords. They can't
# be used in Java source files, but they can be used in compiled class files.
# Note that this hardly improves the obfuscation. Decent decompilers can
# automatically replace reserved keywords, and the effect can fairly simply be
# undone by obfuscating again with simpler names.
# Usage:
#     java -jar proguard.jar ..... -obfuscationdictionary keywords.txt
#

do
if
for
int
new
try
byte
case
char
else
goto
long
this
void
break
catch
class
const
final
float
short
super
throw
while
double
import
native
public
return
static
switch
throws
boolean
default
extends
finally
package
private
abstract
continue
strictfp
volatile
interface
protected
transient
implements
instanceof
synchronized
6
  • So, I don't think there's a way to randomize it, is there? Apr 7, 2012 at 20:19
  • 2
    Well, you could write a simple program to generate a dictionary file which is full of randomly generated strings of characters.
    – ulmangt
    Apr 7, 2012 at 20:35
  • In fact, random.org/strings has a web-form generator which does exactly that for you. And it spits it out in a format you could use for your dictionary file.
    – ulmangt
    Apr 7, 2012 at 20:37
  • Yeah, yeah, dumb question, duh. Of course, just generate the random and put inside the dict... thanks for your help. Apr 7, 2012 at 20:50
  • 1
    Will the resulting bytecode be bigger than using simple a,b,c?
    – eastwater
    Dec 26, 2020 at 23:46
3

Any text file will work. ProGuard uses all valid identifiers in the file. It ignores lines starting with '#'. The directory examples/dictionaries in the ProGuard distribution contains a few examples (including the example pasted by ulmangt).

1
  • So using this dictionary isn't a good idea? Is that the point? Mar 15, 2021 at 20:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.