Obfuscating your processing code on your own

Hi,

This line works perfectly in Processing :

void draw() {background(0);frameRate(30);stroke(255);}

Since it’s Java based, there’s no Processing special syntax and grammar rule.

In fact, renaming variables to complex names or with one letter names can prevent people from reading your code but with a simple tool, you can replace and read easily the code.

For example minifying Processing code :

// Pretty code

void setup(){
  size(500, 500);
  
  background(255);
}

void draw(){
  noStroke();
  
  float r = random(255);
  float g = random(255);
  float b = random(255);
  
  fill(r, g, b);
  
  float diameter = random(10, 50);
  float radius = diameter / 2;
  
  float x = random(radius, width - radius);
  float y = random(radius, height - radius);
  
  circle(x, y, diameter);
}

Which is equivalent to (without spaces, newlines and variable renaming) :

// Minified (but not obfuscated) code
void setup(){size(500, 500);background(255);}void draw(){noStroke();fill(random(255),random(255),random(255));float d=random(10,50);float r=d/2;circle(random(r,width-r),random(r,height-r),d);}

(This was done by hand but there’s tools to do this)

Also some tools appear to affect the bytecode in order to prevent people from doing reverse engineering and decompiling your binary.

This website clearly explain the different types of obfuscation :

Usually, obfuscation is used for production code to make it unreadable or smaller, developers are not working with obfuscated code :wink:

2 Likes