Пример #1
0
 /// <summary>
 /// Constructs a matrix containing all values of 0x00.
 /// </summary>
 /// <param name="g"> The GF(2^8) field being used. </param>
 /// <param name="s"> The S-Box being used. </param>
 /// <param name="b"> The underlying byte array </param>
 /// <param name="sv"> The index of the first value contained in this object within b. </param>
 public BitMatrix(GF28Table g, sBox s, byte[] b, int sv)
 {
     subBox     = s;
     GFBox      = g;
     bytes      = b;
     startValue = sv;
 }
Пример #2
0
 /// <summary>
 /// Constructs a new BitMatrix with the specified 4 "words".
 /// </summary>
 /// <param name="g"> The GF(2^8) field being used. </param>
 /// <param name="s"> The S-Box being used. </param>
 /// <param name="a">The first word. </param>
 /// <param name="b"> The second word. </param>
 /// <param name="c"> The third word. </param>
 /// <param name="d"> THe fourth word. </param>
 public BitMatrix(GF28Table g, sBox s, byte[] a, byte[] b, byte[] c, byte[] d)
 {
     bytes = new byte[SIZE];
     if (a.Length != WORD_LENGTH || b.Length != WORD_LENGTH || c.Length != WORD_LENGTH || d.Length != WORD_LENGTH)
     {
         throw new ArgumentException();
     }
     Array.Copy(a, 0, bytes, 0, a.Length);
     Array.Copy(b, 0, bytes, WORD_LENGTH, b.Length);
     Array.Copy(c, 0, bytes, 2 * WORD_LENGTH, c.Length);
     Array.Copy(d, 0, bytes, 3 * WORD_LENGTH, d.Length);
     startValue = 0;
 }