Integer Array Splitting Obfuscation

Author

Ashok Purushotham Ramasamy Venkatraj (ashok@cs.arizona.edu)

Description

The Array Splitting algorithm splits a single array, which is a local variable in a method, into two arrays and modifies all the array initialization, read, write, and arraylength references consistently and correctly.

Example

Original Program:

        public class finaltest
        {
            public static void main(String args[])
            {
                int i=1;
                try{
                    int[] arr={1,2,i*i*i,getValue()};
                    arr[i++]=i*i;
                    arr[i++]=arr[getValue()]*arr[i++];
                    i=56;

                    arr[2]=i*getValue();
                }
                catch(Exception e1)
                {
                    System.out.println("HELLO");
                }
                i=5;
            }

            public static int getValue()
            {
                return 1;
            }

        }

Obfuscated Program:

        import java.io.PrintStream;

        public class finaltest
        {

            public finaltest()
            {
            }

            public static void main(String args[])
            {
                int i = 1;
                try
                {
                    int ai[] = new int[2];
                    int ai1[] = new int[2];
                    ai[0] = 1;
                    ai1[0] = 2;
                    ai[1] = i * i * i;
                    ai1[1] = getValue();
                    int j = i;
                    if(j % 2 == 0)
                        ai[j / 2] = ++i * i;
                    else
                        ai1[j / 2] = ++i * i;
                    int k = i;
                    if(k % 2 == 0)
                    {
                        i++;
                        int l;
                        int i1;
                        ai[k / 2] = ((l = getValue()) % 2 != 0 ? ai1[l] : ai[l]) *
                                    ((i1 = i++) % 2 != 0 ? ai1[i1] : ai[i1]);
                    } else
                    {
                        i++;
                        int j1;
                        int k1;
                        ai1[k / 2] = ((j1 = getValue()) % 2 != 0 ? ai1[j1] : ai[j1]) *
                                     ((k1 = i++) % 2 != 0 ? ai1[k1] : ai[k1]);
                    }
                    i = 56;
                    byte byte0 = 2;
                    if(byte0 % 2 == 0)
                        ai[byte0 / 2] = i * getValue();
                    else
                        ai1[byte0 / 2] = i * getValue();
                }
                catch(Exception exception)
                {
                    System.out.println("HELLO");
                }
                i = 5;
            }

            public static int getValue()
            {
                return 1;
            }
        }

Configuration

There are no extra configuration parameters necessary to run this obfuscator.

References