Control-Flow Flattening

Potency High
Resilience High
Cost High


Control-flow Flattening obfuscates the program's control-flow by adding opaque predicates; flattening the control-flow; and adding irrelevant code clones.

Warning: When Self Healing is used, all control-flow flattening options are ignored, including options to enable/disable this obfuscation.

Code Annotation Example

// @jscrambler define controlFlowFlattening {features: [opaqueSteps], minimumBlockSize: 2} as cff
// @jscrambler enable cff

Option Types

Name Required Default Value Description
features No [] List of available features
minimumBlockSize No 1 The number of statements present in a block under which the transformation will skip that block. Accepts values between 1 and 4.


Name Description
clones Clones are semantically equivalent copies of basic blocks that can be executed interchangeably with their original basic blocks.
deadClones Dead Clones are dummy copies of basic blocks that are never executed, but mimic and can be confused with the code that will be executed, adding up to the confusion factor.
opaqueSteps Opaque Steps obfuscates the switching variable, making it harder to understand what is the next switch case that’ll be executed.

Browser Compatibility

Browser Compatible Versions Tested Versions Notes
Chrome 80+ 80+
Firefox 90+ 90+
Internet Explorer 8+ 8+
Microsoft Edge 116+ 116+
Safari 13.1+ 13.1+

API Parameters


  "keys": {
    "accessKey": "XXXXXX",
    "secretKey": "YYYYYY"
  "applicationId": "ZZZZZZ",
  "params": [
      "name": "controlFlowFlattening",
      "options": {
        "features": [],
        "minimumBlockSize": 1