Пример #1
0
        public string plain(string cplain)
        {
            string ppbb = "";

            for (int i = 0; i < cplain.Length; i += 4)
            {
                string H = "";
                for (int j = i; j < i + 4; j++)
                {
                    H += cplain[j];
                }
                decdes s = new decdes();
                int    L = s.abdo(H);
                char   Q = L < 10 ? '0' : 'A';
                if (L > 9)
                {
                    L -= 10;
                }
                while (L > 0)
                {
                    L = L - 1;
                    Q++;
                }
                ppbb += Q;
            }
            cplain = ppbb;

            return(cplain);
        }
Пример #2
0
        public string plainnnn(string Plain)
        {
            string pb = "";

            for (int i = 0; i < 64; i++)
            {
                pb += Plain[i1[i] - 1];
            }
            Plain = pb;

            string l = "", r = "";

            for (int i = 32; i < 64; i++)
            {
                r = r + Plain[i];
            }
            for (int i = 0; i < 32; i++)
            {
                l = l + Plain[i];
            }

            for (int i = 1; i <= 16; i++)
            {
                string l2  = r;
                decdes s   = new decdes();
                string res = s.rf(r, listofkeys[i - 1]);
                string r2  = "";
                for (int uu = 0; uu < l.Length; uu++)
                {
                    if (l[uu] == res[uu])
                    {
                        r2 += '0';
                    }
                    else
                    {
                        r2 += '1';
                    }
                }
                l = l2;
                r = r2;
            }
            pb = "";
            for (int i = 0; i < 32; i++)
            {
                pb = pb + r[i];
            }
            for (int i = 0; i < 32; i++)
            {
                pb = pb + l[i];
            }
            Plain = pb;

            pb = "";
            for (int i = 0; i < 64; i++)
            {
                pb += Plain[i2[i] - 1];
            }
            Plain = pb;
            pb    = "";
            for (int i = 0; i < Plain.Length; i += 4)
            {
                string ff = "";
                for (int j = i; j < i + 4; j++)
                {
                    ff += Plain[j];
                }
                decdes s  = new decdes();
                int    ii = s.abdo(ff);
                char   A  = ii < 10 ? '0' : 'A';
                if (ii > 9)
                {
                    ii -= 10;
                }
                while (ii > 0)
                {
                    ii--;
                    A++;
                }
                pb += A;
            }
            Plain = pb;

            return(Plain);
        }