desFunc method
Implementation
void desFunc(
List<int> wKey,
Uint8List inp,
int inOff,
Uint8List out,
int outOff,
) {
int work, right, left;
left = _bigEndianToInt(inp, inOff);
right = _bigEndianToInt(inp, inOff + 4);
work = ((shiftr32(left, 4)) ^ right) & 0x0f0f0f0f;
right ^= work;
left ^= shiftl32(work, 4);
work = ((shiftr32(left, 16)) ^ right) & 0x0000ffff;
right ^= work;
left ^= shiftl32(work, 16);
work = ((shiftr32(right, 2)) ^ left) & 0x33333333;
left ^= work;
right ^= shiftl32(work, 2);
work = ((shiftr32(right, 8)) ^ left) & 0x00ff00ff;
left ^= work;
right ^= shiftl32(work, 8);
right = (shiftl32(right, 1)) | (shiftr32(right, 31));
work = (left ^ right) & 0xaaaaaaaa;
left ^= work;
right ^= work;
left = (shiftl32(left, 1)) | (shiftr32(left, 31));
for (var round = 0; round < 8; round++) {
int fval;
work = (shiftl32(right, 28)) | (shiftr32(right, 4));
work ^= wKey[round * 4 + 0];
fval = SP7[work & 0x3f];
fval |= SP5[(shiftr32(work, 8)) & 0x3f];
fval |= SP3[(shiftr32(work, 16)) & 0x3f];
fval |= SP1[(shiftr32(work, 24)) & 0x3f];
work = right ^ wKey[round * 4 + 1];
fval |= SP8[work & 0x3f];
fval |= SP6[(shiftr32(work, 8)) & 0x3f];
fval |= SP4[(shiftr32(work, 16)) & 0x3f];
fval |= SP2[(shiftr32(work, 24)) & 0x3f];
left ^= fval;
work = (shiftl32(left, 28)) | (shiftr32(left, 4));
work ^= wKey[round * 4 + 2];
fval = SP7[work & 0x3f];
fval |= SP5[(shiftr32(work, 8)) & 0x3f];
fval |= SP3[(shiftr32(work, 16)) & 0x3f];
fval |= SP1[(shiftr32(work, 24)) & 0x3f];
work = left ^ wKey[round * 4 + 3];
fval |= SP8[work & 0x3f];
fval |= SP6[(shiftr32(work, 8)) & 0x3f];
fval |= SP4[(shiftr32(work, 16)) & 0x3f];
fval |= SP2[(shiftr32(work, 24)) & 0x3f];
right ^= fval;
}
right = (shiftl32(right, 31)) | (shiftr32(right, 1));
work = (left ^ right) & 0xaaaaaaaa;
left ^= work;
right ^= work;
left = (shiftl32(left, 31)) | (shiftr32(left, 1));
work = ((shiftr32(left, 8)) ^ right) & 0x00ff00ff;
right ^= work;
left ^= shiftl32(work, 8);
work = ((shiftr32(left, 2)) ^ right) & 0x33333333;
right ^= work;
left ^= shiftl32(work, 2);
work = ((shiftr32(right, 16)) ^ left) & 0x0000ffff;
left ^= work;
right ^= shiftl32(work, 16);
work = ((shiftr32(right, 4)) ^ left) & 0x0f0f0f0f;
left ^= work;
right ^= shiftl32(work, 4);
_intToBigEndian(right, out, outOff);
_intToBigEndian(left, out, outOff + 4);
}