private static bool Decrypt(Stream input, Stream output)
        {
            var size = (int)input.Length;

            ThCrypt.Decrypt(input, output, size, 0x3A, 0xCD, 0x0100, 0x0C00);

            var data = new byte[size];

            output.Seek(0, SeekOrigin.Begin);
            output.Read(data, 0, size);

            uint checksum = 0;
            byte temp     = 0;

            for (var index = 2; index < size; index++)
            {
                temp        += data[index - 1];
                temp         = (byte)((temp >> 5) | (temp << 3));
                data[index] ^= temp;
                if (index > 3)
                {
                    checksum += data[index];
                }
            }

            output.Seek(0, SeekOrigin.Begin);
            output.Write(data, 0, size);

            return((ushort)checksum == BitConverter.ToUInt16(data, 2));
        }
        private static bool Decrypt(Stream input, Stream output)
        {
            var reader = new BinaryReader(input);
            var writer = new BinaryWriter(output);

            var header = new Header();

            header.ReadFrom(reader);
            if (!header.IsValid)
            {
                return(false);
            }
            if (header.EncodedAllSize != reader.BaseStream.Length)
            {
                return(false);
            }

            header.WriteTo(writer);
            ThCrypt.Decrypt(input, output, header.EncodedBodySize, 0xAC, 0x35, 0x10, header.EncodedBodySize);

            return(true);
        }