Skip to content

Latest commit

 

History

History
60 lines (47 loc) · 1.24 KB

readme.md

File metadata and controls

60 lines (47 loc) · 1.24 KB

Simple String obfuscator

Use this simple tool to hide real string constants from decompilation.

example

Usage

Generate byte-array from pseudo-random integers.

./obfuscate_string.sh hello

Copy output to your code:

(new Object() {
    int t;
    public String toString() {
        byte[] buf = new byte[5];
        t = 1220204165; buf[0] = (byte) (t >>> 4);
        t = 1731395377; buf[1] = (byte) (t >>> 15);
        t = -1241489993; buf[2] = (byte) (t >>> 23);
        t = 56640078; buf[3] = (byte) (t >>> 19);
        t = 350056403; buf[4] = (byte) (t >>> 8);
        return new String(buf);
    }
}.toString())

Result

Before:

doSomethingWithSecret("hello");

After:

doSomethingWithSecret((new Object() {
    int t;
    public String toString() {
        byte[] buf = new byte[5];
        t = 1220204165; buf[0] = (byte) (t >>> 4);
        t = 1731395377; buf[1] = (byte) (t >>> 15);
        t = -1241489993; buf[2] = (byte) (t >>> 23);
        t = 56640078; buf[3] = (byte) (t >>> 19);
        t = 350056403; buf[4] = (byte) (t >>> 8);
        return new String(buf);
    }
}.toString()));