private int DecryptBlock(
byte[] input,
int inOff,
byte[] outBytes,
int outOff)
{
// load A,B,C and D registers from out.
int A = BytesToWord(input, inOff);
int B = BytesToWord(input, inOff + bytesPerWord);
int C = BytesToWord(input, inOff + bytesPerWord*2);
int D = BytesToWord(input, inOff + bytesPerWord*3);
// Undo pseudo-round #(ROUNDS+1) : post whitening of A and C
C -= _S[2*_noRounds+3];
A -= _S[2*_noRounds+2];
// Undo round #ROUNDS, .., #2,#1 of encryption
for (int i = _noRounds; i >= 1; i--)
{
int t=0,u = 0;
int temp = D;
D = C;
C = B;
B = A;
A = temp;
t = B*(2*B+1);
t = RotateLeft(t, LGW);
u = D*(2*D+1);
u = RotateLeft(u, LGW);
C -= _S[2*i+1];
C = RotateRight(C,t);
C ^= u;
A -= _S[2*i];
A = RotateRight(A,u);
A ^= t;
}
// Undo pseudo-round #0: pre-whitening of B and D
D -= _S[1];
B -= _S[0];
WordToBytes(A, outBytes, outOff);
WordToBytes(B, outBytes, outOff + bytesPerWord);
WordToBytes(C, outBytes, outOff + bytesPerWord*2);
WordToBytes(D, outBytes, outOff + bytesPerWord*3);
return 4 * bytesPerWord;
}