以下程序是一个信息编码的程序,阅读其encode部分,并补全其decode部分
最后运行程序,会打印出的一句话。这句话就是我们要求的答案。注意!这句话是用GBK编码的!
答案请复制粘贴, 不要手动输入public class Test { public static void encode(byte[] in, byte[] out, int password) {
int len = in.length; int seed = password ^ 0x3e1e25e6;
for (int i = 0; i < len; ++i) {
byte a = (byte) ((in[i] ^ seed) >>> 3);
byte b = (byte) (((((int) in[i]) << 18) ^ seed) >>> (18 - 5));
a &= 0x1f;
b &= 0xe0;
out[i] = (byte) (a | b);
seed = (seed * 84723701 ^ seed ^ out[i]);
}
} public static void decode(byte[] in, byte[] out, int password) {
int len = in.length;
int seed = password ^ 0x3e1e25e6;
for (int i = 0; i < len; ++i) {
// fill the code here
}
} public static void main(String[] args) throws Exception {
int password = 0xfdb4d0e9;
byte[] buf1 = { -5, 9, -62, -122, 50, 122, -86, 119, -101, 25, -64,
-97, -128, 95, 85, 62, 99, 98, -94, 76, 12, 127, 121, -32,
-125, -126, 15, 18, 100, 104, -32, -111, -122, 110, -4, 60, 57,
21, 36, -82, };
byte[] buf2 = new byte[buf1.length];
decode(buf1, buf2, password);
System.out.println(new String(buf2, "GBK"));
}
}
在线等候

解决方案 »

  1.   


    byte a = (byte) (in[i] & 0x1f);
    byte b = (byte) (in[i] & 0xe0);
    a = (byte) (((a <<3) ^ seed) & 0xe0);
    b = (byte) ((((((int) b) << (18 - 5)) ^ seed) >> 18) & 0x1f);
    out[i] = (byte) (a | b);
    seed = (seed * 84723701 ^ seed ^ in[i]);
      

  2.   

    参考的网站上其他题目之后改的,自己还不是很理解public static void decode(byte[] in, byte[] out, int password) {
            int len = in.length;
            int seed = password ^ 0x3e1e25e6;
            for (int i = 0; i < len; ++i) {
                // fill the code here
             byte a = (byte) (in[i] & 0x1f);
             byte b = (byte) (in[i] & 0xe0);
             a = (byte) (((a << 3) ^ seed) & 0xf8);
             b = (byte) (((b << (18-5) ^ seed) >> 18) & 0x07);
             out[i] = (byte) (a | b);
             seed = (seed * 84723701 ^ seed ^ in[i]);
            }
        }
      

  3.   

    ....整半天才整出来 public static void decode(byte[] in, byte[] out, int password)
    {
    int len = in.length;
    int seed = password ^ 0x3e1e25e6;
    for (int i = 0; i < len; ++i)
    {
     // fill the code here
    byte a = (byte) ((in[i]<<3)^seed);
    byte b = (byte) (((int)in[i]<<13^seed)>>18);
    a &= 0xf8;
    b &= 0x07;
    out[i] = (byte)(a | b);
    seed = (seed * 84723701 ^ seed ^ in[i]);

    }
    }输出的是这玩意太坑爹了
    真双核引擎是全球最快的浏览器内核!!!!
      

  4.   


    输入部分的
                a &= 0xf8;
                b &= 0x07;
    是怎么得出来的啊?纠结好长时间了。