Encryption
Text resource encryption
Several text files (mainly IDS files) are encrypted, to prevent casual tampering. The encryption is achieved by a simple 512bit XOR scheme. Each byte of the plaintext is XOR'd with a byte of the key. The key is rotated cyclically. The IE key is 64 bytes, so bytes 0-63 of the plaintext are XOR'd with bytes 0-63 of key, bytes 64-127 are XOR'd with bytes 0-63 of key, etc. Encrypted files have a 'header' of 0xFF 0xFF are the first two bytes.
The encryption key is:
The encryption key is:
88 a8 8f ba 8a d3 b9 f5 ed b1 cf ea aa e4 b5 fb eb 82 f9 90 ca c9 b5 e7 dc 8e b7 ac ee f7 e0 ca 8e ea ca 80 ce c5 ad b7 c4 d0 84 93 d5 f0 eb c8 b4 9d cc af a5 95 ba 99 87 d2 9d e3 91 ba 90 ca
Executable string encryption
Several strings within the executable file are encrypted, to prevent casual detection. The encrypted strings are mainly cheat codes.
The strings are encrypted via the following algorithm:
Strings within the IWD2 executable are encrypted with the algorithm: y=x*2+8.
The strings are encrypted via the following algorithm:
char = (char + 8) << 1The strings can be decrypted using the algorithm in reverse:
char = (char >> 1) - 8
Strings within the IWD2 executable are encrypted with the algorithm: y=x*2+8.