放到模拟器上运行是一个验证框 用工具反编译看看 有一个检查函数 找在那个函数

大概知道算法 1.它先去获取 key 2.然创建一个数组 3.然后计算 要注意的是它有俩个 getkey()函数 看看反编译的源码发现读不通其中就有: 可能是工具的问题 换个就清析了 找到关键点 他是把密码一个个字符计算

if ((iArr[i] & 255) != ((str.charAt(i) ^ str2.charAt(i % str2.length())) & 255)) {
//                throw new RuntimeException();
//            }

那好办我就暴力求解(当前类中的key 是错的)

key :   bobdylan
密码:blow,in the winD

源码

public class allen {
    //正确 key
    public static  String getKey() {
        return "bobdylan";
    }
    public static void  main(String[] args){


        check("allen");
       // System.out.println("allenboy");
    }
    public static void check(String str) {
        int i = 0;
        if (str.length() != 16) {
            //throw new RuntimeException();
        }
        String str2 = "";
        try {
            str2 = getKey();
        } catch (Exception e) {
            System.out.println("allenboy");
            str2 = getKey();
            System.arraycopy(str2, 0, str, 5, 5);
        }
        int[] iArr = new int[16];
        iArr[0] = 0;
        iArr[12] = 14;
        iArr[10] = 7;
        iArr[14] = 15;
        iArr[15] = 42;
        try {
            iArr[1] = 3;
            iArr[5] = 5;
            System.out.println();
        } catch (Exception e2) {
            iArr[5] = 37;
            iArr[1] = 85;
        }
        iArr[6] = 15;
        iArr[2] = 13;
        iArr[3] = 19;
        iArr[11] = 68;
        iArr[4] = 85;
        iArr[13] = 5;
        iArr[9] = 7;
        iArr[7] = 78;
        iArr[8] = 22;
        System.out.println(str2);
        while (i < 16) {  //str为参数     str2为 key
            for(int j=0;j<128;j++){
                char c=(char)j;
                if ((iArr[i] & 255) == ((c^ str2.charAt(i % str2.length())) & 255)) {
                   System.out.print(c);
                }
            }
            i++;
        }
    }

}


//    public void check(String str) {
//        int i = 0;
//        if (str.length() != 16) {
//            throw new RuntimeException();
//        }
//        String str2 = "";
//        try {
//            str2 = getKey();
//        } catch (Exception e) {
//            str2 = getKey();
//            System.arraycopy(str2, 0, str, 5, 5);
//        }
//        int[] iArr = new int[16];
//        iArr[0] = 0;
//        iArr[12] = 14;
//        iArr[10] = 7;
//        iArr[14] = 15;
//        iArr[15] = 42;
//        try {
//            iArr[1] = 3;
//            iArr[5] = 5;
//            System.out.println();
//        } catch (Exception e2) {
//            iArr[5] = 37;
//            iArr[1] = 85;
//        }
//        iArr[6] = 15;
//        iArr[2] = 13;
//        iArr[3] = 19;
//        iArr[11] = 68;
//        iArr[4] = 85;
//        iArr[13] = 5;
//        iArr[9] = 7;
//        iArr[7] = 78;
//        iArr[8] = 22;
//        while (i < str.length()) {
//            if ((iArr[i] & 255) != ((str.charAt(i) ^ str2.charAt(i % str2.length())) & 255)) {
//                throw new RuntimeException();
//            }
//            i++;
//        }
//    }
//
//    public String getKey() {
//        return "bobbydylan";
//    }