public void WriteOffset(uint pValue) { uint encOffset = (uint)BaseStream.Position; encOffset = (encOffset - Header.FStart) ^ 0xFFFFFFFF; encOffset *= Hash; encOffset -= CryptoConstants.WZ_OffsetConstant; encOffset = WzTool.RotateLeft(encOffset, (byte)(encOffset & 0x1F)); uint writeOffset = encOffset ^ (pValue - (Header.FStart * 2)); Write(writeOffset); }
public uint ReadOffset() { uint offset = (uint)BaseStream.Position; offset = (offset - Header.FStart) ^ uint.MaxValue; offset *= Hash; offset -= CryptoConstants.WZ_OffsetConstant; offset = WzTool.RotateLeft(offset, (byte)(offset & 0x1F)); uint encryptedOffset = ReadUInt32(); offset ^= encryptedOffset; offset += Header.FStart * 2; return(offset); }