Beispiel #1
0
        string decrypt(int stringId)
        {
            reader.BaseStream.Position = reader.BaseStream.Length + (stringId * 4 - fileDispl);

            uint v0 = reader.ReadUInt32();
            uint v1 = reader.ReadUInt32();

            DeobUtils.xteaDecrypt(ref v0, ref v1, key, 32);
            int utf8Length = (int)v0;
            var decrypted  = new uint[(utf8Length + 11) / 8 * 2 - 1];

            decrypted[0] = v1;
            for (int i = 1; i + 1 < decrypted.Length; i += 2)
            {
                v0 = reader.ReadUInt32();
                v1 = reader.ReadUInt32();
                DeobUtils.xteaDecrypt(ref v0, ref v1, key, 32);
                decrypted[i]     = v0;
                decrypted[i + 1] = v1;
            }

            var utf8 = new byte[utf8Length];

            Buffer.BlockCopy(decrypted, 0, utf8, 0, utf8.Length);
            return(Encoding.UTF8.GetString(utf8));
        }