Zelix KlassMaster - Documentation

Reproducible Obfuscated Output Tutorial

This tutorial is divided into the following sections:


There may be scenarios where you may require your obfuscated output to be reproducible at the byte level. For example, you may wish your ouput files to have exactly the same SHA-256 values across builds. You can achieve this using Zelix KlassMaster™ if the following requirements are satisfied.
  1. The files that you open for obfuscation of course must be absolutely identical across builds,
  2. Your ZKM Script must always use exactly the same settings,
  3. You must specify the ZKM_USE_PARALLEL=false configuration option,
  4. You must specify the ZKM_REPRODUCIBLE_RANDOM=true configuration option,
  5. You must set the ZKM_RANDOM_SEED configuration option to some consistent long value and
  6. You must specify a consistent last modified time on your ZKM Script saveAll statement so that all saved archive entries are given the same consistent last modified date.

For example (in Windows™), you could use a command line like the following.

java -D"ZKM_USE_PARALLEL=false" -D"ZKM_REPRODUCIBLE_RANDOM=true" -D"ZKM_RANDOM_SEED=962008" -jar ZKM.jar MyScript.txt

Additional Options

If you are specifying reproducible obfuscated output then you can optionally also specify additional options on your ZKM Script open statement. You can use the expectedInitial_SHA256 and expectedFinal_SHA256 parameters so that you can get a quick fatal error if the files you are opening for obfuscation or your saved obfuscated output is not exactly as expected.

Even though you are specifying reproducible obfuscated output, you can also optionally specify randomize=true on your ZKM Script obfuscate statement. This is somewhat counter-inuitive but specifing randomize=true increases the initial degree of randomness for a given ZKM_RANDOM_SEED value without compromizing reproducibility provided the ZKM_REPRODUCIBLE_RANDOM=true option is also used.


Randomness is essential for effective obfuscation. For this reason it is essential that your ZKM_RANDOM_SEED value be randomly generated and changed whenever it is practicable. The use of the obfuscate statement's randomize=true option (discussed above) is highly recommended.
Documentation Table of Contents
Zelix KlassMaster - Java Obfuscator