Exemple #1
0
        static GCHandle Decrypt(uint[] data, uint seed)
        {
            var   w = new uint[0x10];
            var   k = new uint[0x10];
            ulong s = seed;

            for (int i = 0; i < 0x10; i++)
            {
                s    = (s * s) % 0x143fc089;
                k[i] = (uint)s;
                w[i] = (uint)((s * s) % 0x444d56fb);
            }
            Mutation.Crypt(w, k);
            Array.Clear(k, 0, 0x10);

            var  b = new byte[data.Length << 2];
            uint h = 0;

            for (int i = 0; i < data.Length; i++)
            {
                uint d = data[i] ^ w[i & 0xf];
                w[i & 0xf] = (w[i & 0xf] ^ d) + 0x3ddb2819;
                b[h + 0]   = (byte)(d >> 0);
                b[h + 1]   = (byte)(d >> 8);
                b[h + 2]   = (byte)(d >> 16);
                b[h + 3]   = (byte)(d >> 24);
                h         += 4;
            }
            Array.Clear(w, 0, 0x10);
            byte[] j = Lzma.Decompress(b);
            Array.Clear(b, 0, b.Length);

            GCHandle g = GCHandle.Alloc(j, GCHandleType.Pinned);
            var      z = (uint)(s % 0x8a5cb7);

            for (int i = 0; i < j.Length; i++)
            {
                j[i] ^= (byte)s;
                if ((i & 0xff) == 0)
                {
                    s = (s * s) % 0x8a5cb7;
                }
            }
            return(g);
        }
Exemple #2
0
        // Hmm... Too lazy.
        static void Initialize()
        {
            var l = (uint)Mutation.KeyI0;

            uint[] q = Mutation.Placeholder(new uint[Mutation.KeyI0]);

            var k = new uint[0x10];
            var n = (uint)Mutation.KeyI1;

            for (int i = 0; i < 0x10; i++)
            {
                n   ^= n >> 13;
                n   ^= n << 25;
                n   ^= n >> 27;
                k[i] = n;
            }

            int s = 0, d = 0;
            var w = new uint[0x10];
            var o = new byte[l * 4];

            while (s < l)
            {
                for (int j = 0; j < 0x10; j++)
                {
                    w[j] = q[s + j];
                }
                Mutation.Crypt(w, k);
                for (int j = 0; j < 0x10; j++)
                {
                    uint e = w[j];
                    o[d++] = (byte)e;
                    o[d++] = (byte)(e >> 8);
                    o[d++] = (byte)(e >> 16);
                    o[d++] = (byte)(e >> 24);
                    k[j]  ^= e;
                }
                s += 0x10;
            }

            c = Assembly.Load(Lzma.Decompress(o));
            AppDomain.CurrentDomain.AssemblyResolve += Handler;
        }
Exemple #3
0
        static void Initialize()
        {
            var l = (uint)Mutation.KeyI0;

            uint[] q = Mutation.Placeholder(new uint[Mutation.KeyI0]);

            var k = new uint[0x10];
            var n = (uint)Mutation.KeyI1;

            for (int i = 0; i < 0x10; i++)
            {
                n   ^= n >> 12;
                n   ^= n << 25;
                n   ^= n >> 27;
                k[i] = n;
            }

            int s = 0, d = 0;
            var w = new uint[0x10];
            var o = new byte[l * 4];

            while (s < l)
            {
                for (int j = 0; j < 0x10; j++)
                {
                    w[j] = q[s + j];
                }
                Mutation.Crypt(w, k);
                for (int j = 0; j < 0x10; j++)
                {
                    uint e = w[j];
                    o[d++] = (byte)e;
                    o[d++] = (byte)(e >> 8);
                    o[d++] = (byte)(e >> 16);
                    o[d++] = (byte)(e >> 24);
                    k[j]  ^= e;
                }
                s += 0x10;
            }

            b = Lzma.Decompress(o);
        }