returnByte method

  1. @override
int returnByte(
  1. int inp
)
override

Process one byte of data given by inp and return its encrypted value.

Implementation

@override
int returnByte(int inp) {
  _x = (_x + 1) & 0xff;
  _y = (_engineState![_x] + _y) & 0xff;

  // swap
  var tmp = _engineState![_x];
  _engineState![_x] = _engineState![_y];
  _engineState![_y] = tmp;

  // xor
  return inp ^ _engineState![(_engineState![_x] + _engineState![_y]) & 0xff];
}