WZ File

WZ Files hold all the sprites and sound and nearly all the data used in MapleStory.

WZ Encryption
The WZ encryption is different for ASCII- and Unicode-encoded strings:

ASCII:

char ^ (0xAA + offset) ^ key[offset]

Unicode:

char ^ (0xAAAA + offset) ^ ((key[offset * 2 + 1] << 8) + key[offset * 2])

C# example:
sbyte lengthbyte = ReadSByte; int length = lengthbyte; if (lengthbyte == sbyte.MaxValue || lengthbyte == sbyte.MinValue) {  length = ReadInt32; length = (lengthbyte < 0 ? -length : length); } string ret = ""; if(lengthbyte < 0) //ASCII {  for (int i = 0; i < -length; i++) {    byte b = ReadByte; b ^= (0xAA + i); b ^= Key[i]; ret += (char)b; } } else {  for (int i = 0; i < length; i++) {    ushort s = ReadUInt16; s ^= (0xAAAA + i); s ^= (ushort)((Key[i * 2 + 1] << 8) + Key[i * 2]); ret += (char)s; } }

The WZ Format
Insert technical details on the file format, how to parse it, and all that fun stuff.