applyRandomPattern static method

void applyRandomPattern(
  1. List<int> bytesAL,
  2. int startPosition,
  3. int length
)

Implementation

static void applyRandomPattern(
  List<int> bytesAL,
  int startPosition,
  int length,
) {
  for (int i = 0; i < length; i++) {
    //See "B.1 253-state algorithm
    final padCodewordPosition = startPosition + i;
    final padCodewordValue = bytesAL[padCodewordPosition] & 0xff;
    final pseudoRandomNumber = ((149 * (padCodewordPosition + 1)) % 255) + 1;
    final tempVariable = padCodewordValue + pseudoRandomNumber;
    bytesAL[padCodewordPosition] =
        (tempVariable <= 255 ? tempVariable : tempVariable - 256);
  }
}