有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java解码自定义加密文件

我目前正在处理一个旧游戏的保存文件。 我的问题是,文件是用自定义算法加密的。 我对它只有一个模糊的描述:

“通过添加3939,然后将每个DWord向右旋转5位,对文件进行加密。”

我试着在每个4字节块()上使用这个java代码来逆转进程

private static byte[] decryptDWord(byte[] in) {
    //in is 4 bytes

    IntBuffer buf=ByteBuffer.wrap(in).asIntBuffer();
    int dword=buf.get();
    dword=Integer.rotateLeft(dword, 5);
    dword -=0x39393939;
    byte[] out = ByteBuffer.allocate(4).putInt(dword).array();

    return out;
}

但是在0x70, 0x4E, 0x33, 0x43上应用它应该给我0x73, 0x63, 0x30, 0x2E,在0x74, 0x60, 0x33, 0x03上应用它应该给0x73, 0x63, 0x34, 0x20


共 (0) 个答案