static public void calculate(ref byte[] aad, int op)
{
for (int j = 0; j < 6; j++)
Random Rand = new Random();
aad[j] = (byte)Rand.Next(0, 255);
int n;
int i;
int ofs;
byte d;
aad[3 + op] = (byte)(aad[1 + op] ^ aad[2 + op] ^ aad[4 + op]);
aad[0 + op] = (byte)((aad[4 + op] ^ aad[1 + op]) + aad[2 + op]);
aad[5 + op] = 0;
d = (byte)0xd5;
for (n = 0, ofs = 2; n < 17; n++, ofs += 6)
for (i = -2; i <= 3; i++)
d = aad[op + ((ofs + i) % 6)] = (byte)(((ofs + i) % 5 != 0) ? aad[op + ((ofs + i) % 6)] + d : aad[op + ((ofs + i) % 6)] ^ d);
}