Inline methods

This obfuscation erases the encapsulation boundary between various layers of abstraction used in a program, merging independent components into one heavily-interlinked chunk.

BeforeAfter
static void Core()
{
    var x = new MyClass();
    try { DoIt(x); }
    catch { }
}

static void DoIt(MyClass x)
{
    var result = x.Grow();
    Console.WriteLine(result);
}

class MyClass
{
    private double _encapsulated = 42;

    public double Grow()
    {
        lock (this)
            _encapsulated *= 1.5;
        return _encapsulated;
    }
}
static void Core()
{
    var x = new MyClass();
    try
    {
        var x2 = x;
        var @this = x2;
        lock (@this)
            @this._encapsulated *= 1.5;
        var result = @this._encapsulated;
        Console.WriteLine(result);
    }
    catch { }
}

class MyClass
{
    public double _encapsulated = 42;
}

Rummage thoroughly analyzes the program and takes into account accessibility modifiers, inheritance, type nesting, and code that uses reflection. This way inlining is guaranteed to work properly, even in the face of circumstances in which members cannot just be made public. In such cases, Rummage uses a technique called redirect methods which are methods that simply read out a field or call another method. These methods do not impact run-time performance because they are tiny and will therefore be inlined by the JIT compiler.

Why use inlining as an obfuscation?

Inlining is arguably the most powerful obfuscation in Rummage as it irreversibly removes the separation of internal and external logic, code encapsulation and modularity. Furthermore, inlining sometimes changes the code into something that is genuinely impossible to translate directly back to a source language such as C# or Visual Basic.NET. Finally, this optimization additionally results in a run-time performance gain because fewer method calls are required.