解码自定义加密文件
Decoding custom encrypted file
我目前正在处理旧游戏的保存文件。
我的问题是该文件是使用自定义算法加密的。
我只有一个模糊的描述:
"The file is encrypted by adding 39393939 and then rotating each DWord right 5 bits."
我试图在每个 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
我目前正在处理旧游戏的保存文件。 我的问题是该文件是使用自定义算法加密的。 我只有一个模糊的描述:
"The file is encrypted by adding 39393939 and then rotating each DWord right 5 bits."
我试图在每个 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