#103 Daily dose : JAVA code obfuscation


Encryption of JAVA program is technically called as obfuscation.

In software development, obfuscation is the deliberate act of creating obfuscated code, i.e. source or machine code that is difficult for humans to understand.

So, to protect your source code… just obfuscate your JAVA code online here,

http://obfuscat.ion.land/

When you’re programming you may sometimes feel that you need to hide some code from a coworker or a static code analysis tool. If your language happens to be Java, you have come to the right place!

Enter your code in the source code area below and an obfuscated version will appear below. Can’t think of some code right now? Try this example.

The result will look like a comment (even when using an IDE), but in reality the code will execute.

 

Source code

System.out.println(“Hello world”);

Obfuscated code

/* TODO: fix this stuff \u002a\u002f\u0053\u0079\u0073\u0074\u0065\u006d\u002e\u006f\u0075\u0074\u002e\u0070\u0072\u0069\u006e\u0074\u006c\u006e\u0028\u0022\u0048\u0065\u006c\u006c\u006f\u0020\u0077\u006f\u0072\u006c\u0064\u0022\u0029\u003b\u002f\u002a */

RESULT

The obfuscated code will be executed in any IDE

Explanation

How does that work? What’s that Unicode gibberish?

A fun thing about Java is that in addition to ordinary characters, it’s perfectly valid to use unicode escapes in the source code. So \u0061\u0020\u003d\u0020\u0031\u003b is equal to a = 1;, for example. Read more in the specification.

This tool creates something resembling a comment filled with unicode escapes by:

  1. starting a comment with plain characters
  2. ending it with */ in unicode escapes
  3. adding the code converted to unicode escapes
  4. starting a new comment with /* in unicode escapes
  5. and finally ending that comment with */ in plain characters.

 

Advertisements