transformFourInputsByChaChaQuarterRound method

Uint32List transformFourInputsByChaChaQuarterRound(
  1. Uint32List fourInputs
)

Takes a list of four inputs and performs a ChaCha quarter round on them

Implementation

Uint32List transformFourInputsByChaChaQuarterRound(Uint32List fourInputs) {
  fourInputs[0] += fourInputs[1];
  fourInputs[3] ^= fourInputs[0];
  fourInputs[3] = rotateLeft(fourInputs[3], 16);

  fourInputs[2] += fourInputs[3];
  fourInputs[1] ^= fourInputs[2];
  fourInputs[1] = rotateLeft(fourInputs[1], 12);

  fourInputs[0] += fourInputs[1];
  fourInputs[3] ^= fourInputs[0];
  fourInputs[3] = rotateLeft(fourInputs[3], 8);

  fourInputs[2] += fourInputs[3];
  fourInputs[1] ^= fourInputs[2];
  fourInputs[1] = rotateLeft(fourInputs[1], 7);

  return fourInputs;
}