public void ProcessBlock (byte[] input, byte[] output)
{
Buffer.BlockCopy (input, 0, dwordBuff, 0, BLOCK_BYTE_SIZE);
if (encrypt) {
uint d0 = dwordBuff [0];
uint d1 = dwordBuff [1];
// 16 rounds
d0 ^= CipherFunct (d1, 0);
d1 ^= CipherFunct (d0, 1);
d0 ^= CipherFunct (d1, 2);
d1 ^= CipherFunct (d0, 3);
d0 ^= CipherFunct (d1, 4);
d1 ^= CipherFunct (d0, 5);
d0 ^= CipherFunct (d1, 6);
d1 ^= CipherFunct (d0, 7);
d0 ^= CipherFunct (d1, 8);
d1 ^= CipherFunct (d0, 9);
d0 ^= CipherFunct (d1, 10);
d1 ^= CipherFunct (d0, 11);
d0 ^= CipherFunct (d1, 12);
d1 ^= CipherFunct (d0, 13);
d0 ^= CipherFunct (d1, 14);
d1 ^= CipherFunct (d0, 15);
dwordBuff [0] = d1;
dwordBuff [1] = d0;
}
else {
uint d1 = dwordBuff [0];
uint d0 = dwordBuff [1];
// 16 rounds in reverse order
d1 ^= CipherFunct (d0, 15);
d0 ^= CipherFunct (d1, 14);
d1 ^= CipherFunct (d0, 13);
d0 ^= CipherFunct (d1, 12);
d1 ^= CipherFunct (d0, 11);
d0 ^= CipherFunct (d1, 10);
d1 ^= CipherFunct (d0, 9);
d0 ^= CipherFunct (d1, 8);
d1 ^= CipherFunct (d0, 7);
d0 ^= CipherFunct (d1, 6);
d1 ^= CipherFunct (d0, 5);
d0 ^= CipherFunct (d1, 4);
d1 ^= CipherFunct (d0, 3);
d0 ^= CipherFunct (d1, 2);
d1 ^= CipherFunct (d0, 1);
d0 ^= CipherFunct (d1, 0);
dwordBuff [0] = d0;
dwordBuff [1] = d1;
}
Buffer.BlockCopy (dwordBuff, 0, output, 0, BLOCK_BYTE_SIZE);
}