Configuration

Options

Every key of the options object, grouped by what it protects.

All options live in the options object of the configuration file. Boolean options are off unless you, or the profile, turn them on. The transformer behind each option is described in the transformers reference.

Profile

OptionValuesEffect
profileGhost, Low, Medium, High, ExtremeBaseline for every option you do not set. Explicit keys always win.

Renaming

OptionValuesEffect
renameOff, Alphabet, Invisible, IlIlIlIlIlRenames classes, fields and methods in the chosen style.
renameRandombooleanRandom name bodies instead of sequential ones.
renameDictionarystringCustom alphabet for generated names. Empty uses the built-in ones.
renamePackagestringMoves renamed classes, and the classes HashGuard generates, into this package.
renameClassPrefixstringPrefix added to generated class names.
renameClassSuffixstringSuffix added to generated class names.
renameMemberPrefixstringPrefix added to every renamed field and method, for example m_ gives m_q8mF2. Independent from renameClassPrefix.
aggressiveOverloadbooleanReuses names across methods whose descriptors allow it.

Control flow

OptionValuesEffect
controlFlowObfuscationOff, Light, HeavyOpaque predicates: cheap arithmetic (Light) or LDIV-based (Heavy).
controlFlowFlatteningbooleanTurns method control flow into a switch-dispatched state machine.
flattenLoopsbooleanAlso flattens loop bodies. Costs more on hot loops.
cffStateMaskingbooleanXOR-masks the state value of flattened methods at every dispatch.
controlFlowShufflingbooleanPhysically reorders basic blocks after control-flow analysis.
gotoObfuscationbooleanReplaces GOTO with opaque conditional jumps.

Constants and strings

OptionValuesEffect
constantObfuscationOff, Light, FlowMasks numeric constants with arithmetic chains (Light) or predicate branching (Flow).
constantFlowDensitynumber between 0 and 1Share of constants wrapped in flow-based masking. 0 or less masks every constant. The example config uses 0.25.
polymorphMin, polymorphMaxintegersBounds of the arithmetic chains used to mask numbers. 0 keeps the built-in bounds.
saltbooleanAdds a per-class salt used by numeric constant masking.
numberSpeckbooleanEncrypts numeric constants with a per-class SPECK decryptor.
integerTablebooleanMoves small integer constants into per-class tables.
staticFieldInitbooleanMoves static ConstantValue fields into the static initialiser.
comparisonObfuscationbooleanReplaces String.equals calls with hash and proxy logic.
stringEncryptModeFast, Balanced, ExtremeEncrypts string pools and sets the strength of the runtime decryptor. Uses privateLookupIn on Java 9 and later and an invokedynamic fallback that Java 8 accepts.
cryptoKeyBitsintegerAES key size used by string encryption. The example config uses 128.
contextualStringKeybooleanDerives the string encryption IVs from the owning class as well.
multiAlgoStringsbooleanVaries AES modes across classes to break signatures.
polyStringbooleanLightweight per-class XOR string decryptor.
jntPolyStringbooleanPer-call-site keyed XOR string decryptor.
polyStringSkipInterningUnsafebooleanSkips the polymorphic string passes where string interning looks unsafe.

Indirection

OptionValuesEffect
referenceObfuscationbooleanReplaces direct calls and field references with invokedynamic indirection.
methodHandleIndirectionbooleanRoutes private static calls through cached MethodHandle fields.
parameterPackingbooleanPacks the parameters of private methods into carrier arrays.
invokeDispatcherbooleanRoutes owned calls through a per-class switch dispatcher.
methodSaltbooleanAdds a dead int parameter to private method descriptors.
fieldProxybooleanReplaces private field accesses with synthetic proxy methods.
fieldDescriptorMutationbooleanDeclares private fields as Object and casts at every access.

Structure

OptionValuesEffect
ghostMembersbooleanInjects synthetic phantom fields and methods to defeat structural fingerprinting.
ghostMembersIntensebooleanUses the heavier ghost member profile.
annotationConfuserbooleanInjects phantom annotations with invalid descriptors.
blockBreakbooleanAdds labels and edges that fragment the control-flow graph seen by decompilers.
trapEdgebooleanAdds fake try/catch edges around GOTO flow.
accessbooleanMarks classes and fields synthetic to confuse decompilers. Fields annotated @SerializedName are skipped so Gson keeps working.
crasherbooleanInjects constructs that crash common decompilers.

Metadata and ordering

OptionValuesEffect
lineNumbersKeep, Delete, RandomizeHandling of the LineNumberTable.
localVariablesKeep, Delete, ObfuscateHandling of local variable tables.
methodParametersPreserveNames, RemoveAttribute, ObfuscateNamesHandling of the runtime MethodParameters attribute.
removeSourceFilebooleanRemoves the SourceFile attribute from every class.
removeInnerClassesbooleanRemoves the InnerClasses metadata.
shufflebooleanRandomises the declaration order of fields and methods.
shuffleOptionsobjectFine-grained shuffle switches, see below.

shuffleOptions holds one boolean per list that can be shuffled. Every key defaults to true, except methodParameters, which defaults to false because reflection may read parameter names.

KeyShuffles
classesThe order in which classes are written.
fields, methodsField and method declarations.
innerClassesInnerClasses entries.
interfacesThe order of implemented interfaces.
classAttributes, fieldAttributes, methodAttributesNon-standard attributes.
classAnnotations, fieldAnnotations, methodAnnotationsAnnotations.
classTypeAnnotations, fieldTypeAnnotations, methodTypeAnnotationsType annotations.
methodExceptionsDeclared exceptions.
localVariables, localVariableAnnotationsLocal variable metadata and its annotations.
methodParametersMethodParameters metadata.

Runtime protection

OptionValuesEffect
antiTamperbooleanDetects Java agents, debuggers and suspicious JVM arguments at runtime, and halts the JVM.
integrityCheckbooleanRuntime CRC self-checks of selected class bytes.
sensitiveVmbooleanVirtualises the methods listed in sensitiveVmMethods.
sensitiveVmMethodsarray of stringsOriginal method descriptors selected for virtualisation.

Budget

OptionValuesEffect
maxOutputRationumberGlobal instruction budget. 2.0 allows at most twice the instruction count of the input. Heavy transformers such as control-flow flattening stop once the budget is spent. 0 or absent means no budget.

Output and diagnostics

OptionValuesEffect
mappingOutputpathWrites an old-to-new name mapping as JSON, see Stack traces.
verbosebooleanPrints per-transformer timings and debug counters.

Watermark

watermarkOptions embeds a mark of your choice through explicit channels. Empty texts embed nothing. With renaming on, the dummy class gets a generated name instead of leaking its text as a class name.

KeyValuesEffect
dummyClass, dummyClassTextboolean, stringAdds a synthetic class carrying the text.
textInsideClass, textInsideClassTextboolean, stringEmbeds the text inside an existing class.
ldcPop, ldcPopTextboolean, stringInserts the text as dead LDC/POP constants.
zipComment, zipCommentTextboolean, stringWrites the text into the jar’s ZIP comment.

Encryption

OptionValuesEffect
magicCrypterbooleanEncrypts every class. Part of the hardened runtime and requires its JVM.