Dokümantasyon
/
Temel Obfuscation
/

Control Flow Flattening

Control Flow Flattening

controlFlowFlattening
~1.5x slower

Orijinal program akışını gizlemek için kod yapısını dönüştürür. Doğrusal kodu switch ifadesi içeren bir durum makinesine çevirerek manuel analizi çok daha zor hale getirir.

// Before
function process() {
    step1();
    step2();
    step3();
}

// After (flattened)
function process() {
    var state = '0|1|2'.split('|'), i = 0;
    while (true) {
        switch (state[i++]) {
            case '0': step1(); continue;
            case '1': step2(); continue;
            case '2': step3(); continue;
        }
        break;
    }
}

Control Flow Flattening, diğer temel seçeneklerle ve VM obfuscation ile iyi uyum sağlar - VM etkinleştirildiğinde düzleştirilmiş durum makinesi ayrıca bayt koduna dönüştürülür.