Exemplo n.º 1
0
        private static uint[] Decrypt(uint[] v, uint[] k)
        {
            int num = v.Length - 1;

            if (num < 1)
            {
                return(v);
            }
            uint y    = v[0];
            int  num2 = 6 + 52 / (num + 1);

            for (uint num3 = (uint)((long)num2 * (long)(-1640531527)); num3 != 0u; num3 -= 2654435769u)
            {
                uint e = num3 >> 2 & 3u;
                int  i;
                uint z;
                for (i = num; i > 0; i--)
                {
                    z = v[i - 1];
                    y = (v[i] -= XXTEA.MX(num3, y, z, i, e, k));
                }
                z = v[num];
                y = (v[0] -= XXTEA.MX(num3, y, z, i, e, k));
            }
            return(v);
        }
Exemplo n.º 2
0
        private static uint[] Encrypt(uint[] v, uint[] k)
        {
            int num = v.Length - 1;

            if (num < 1)
            {
                return(v);
            }
            uint z    = v[num];
            uint num2 = 0u;
            int  num3 = 6 + 52 / (num + 1);

            while (0 < num3--)
            {
                num2 += 2654435769u;
                uint e = num2 >> 2 & 3u;
                int  i;
                uint y;
                for (i = 0; i < num; i++)
                {
                    y = v[i + 1];
                    z = (v[i] += XXTEA.MX(num2, y, z, i, e, k));
                }
                y = v[0];
                z = (v[num] += XXTEA.MX(num2, y, z, i, e, k));
            }
            return(v);
        }