Skip to content

"stable" identifier demangling #154

@Le0Developer

Description

@Le0Developer

When diffing deobfuscating minified code (not obfuscated) often most changes are simple identifier renames.
So my feature request is "stable" identifier demangling, kinda like the current "All Names" option but stabler.

Currently, it just counts up:

// input
var a = 100, b = 500, c = 1000;
// output
var v = 100;
var v2 = 500;
var v3 = 1000;

Now if we add a new variable at the top all variables are changed which causes a huge diff:

// input
var a = 1, b = 100, c = 500, d = 1000;
// output
var v = 1;
var v2 = 100;
var v3 = 500;
var v4 = 1000;

So instead my suggestion is somehow making the chosen name stable.
An idea I had was hashing various attributes of a variable like:

  • the initialization value
  • count usages
  • general location (which function it's in)

With the example from above:

// input
var a = 100, b = 500, c = 1000;
// output
var v100_0_g = 100;
var v500_0_g = 500;
var v1000_0_g = 1000;

// input
var a = 1, b = 100, c = 500, d = 1000;
// output
var v1_0_g = 1; // only changed line!
var v100_0_g = 100;
var v500_0_g = 500;
var v1000_0_g = 1000;

Where the format is v${initialValue}_${usages}_${scope} (scope = "g"lobal). Of course this is a very naive example, real world would probably involve a hash.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions