Exemplo n.º 1
0
        public blmat(String s)
        {
            int n, j, i = 0;
            n = s.Length / 16;
            String[] str;

            nBl = (16-(s.Length % 16));//asd
            if (s.Length % 16 != 0)
            {
                i = 1;
                str = new String[n+1];
            }
            else
                str = new String[n];

            for (j = 0; j < n; j++)
                str[j] = s.Substring(j*16, 16);
            if (i == 1)
            {
                str[n] = s.Substring(j * 16, s.Length - j * 16) + (new String('\v', (16 - (s.Length - j * 16))));
                len = n + 1;
            }
            else
                len = n;

            blist=new bloc[len];
            for (j = 0; j < len; j++)
                blist[j] = new bloc(str[j]);
            keyl[0] = key;
        }
Exemplo n.º 2
0
 public blmat(byte[] b)
 {
     len      = 1;
     blist    = new bloc[len];
     blist[0] = new bloc(b);
     keyl[0]  = key;
 }
Exemplo n.º 3
0
 public blmat(byte[] b)
 {
     len = 1;
     blist = new bloc[len];
     blist[0] = new bloc(b);
     keyl[0] = key;
 }
Exemplo n.º 4
0
 public void invaddRKey(bloc bl, int cnt)
 {
     for (int c = 0; c < 4; c++)
     {
         for (int l = 0; l < 4; l++)
         {
             bl.retbl()[l, c] = (byte)(bl.retbl()[l, c] ^ keyl[cnt + 1][l, c]);
         }
     }
 }
Exemplo n.º 5
0
        public blmat(byte[] b)
        {
            len = b.Length / 16;
            blist = new bloc[len];
            byte[] c = new byte[16];
            for (int cnt = 0; cnt < len; cnt++)
                for (int i = 0; i < 16; i++)
                {
                    c[i] = b[cnt * 16 + i];
                    blist[cnt] = new bloc(c);
                }

            keyl[0] = key;
        }
Exemplo n.º 6
0
        public blmat(byte[] b)
        {
            len   = b.Length / 16;
            blist = new bloc[len];
            byte[] c = new byte[16];
            for (int cnt = 0; cnt < len; cnt++)
            {
                for (int i = 0; i < 16; i++)
                {
                    c[i]       = b[cnt * 16 + i];
                    blist[cnt] = new bloc(c);
                }
            }

            keyl[0] = key;
        }
Exemplo n.º 7
0
        public blmat(String s)
        {
            int n, j, i = 0;

            n = s.Length / 16;
            String[] str;

            nBl = (16 - (s.Length % 16));//asd
            if (s.Length % 16 != 0)
            {
                i   = 1;
                str = new String[n + 1];
            }
            else
            {
                str = new String[n];
            }

            for (j = 0; j < n; j++)
            {
                str[j] = s.Substring(j * 16, 16);
            }
            if (i == 1)
            {
                str[n] = s.Substring(j * 16, s.Length - j * 16) + (new String('\v', (16 - (s.Length - j * 16))));
                len    = n + 1;
            }
            else
            {
                len = n;
            }

            blist = new bloc[len];
            for (j = 0; j < len; j++)
            {
                blist[j] = new bloc(str[j]);
            }
            keyl[0] = key;
        }
Exemplo n.º 8
0
 public void addRKey(bloc bl, int cnt)
 {
     for (int c = 0; c < 4; c++)
         for (int l = 0; l < 4; l++)
             bl.retbl()[l, c] = (byte)(bl.retbl()[l, c] ^ keyl[cnt+1][l, c]);
 }