def nonlinear_function(byte, constant): byte ^= constant state = (byte + 1) % 256 byte ^= eight_bit_integer(state << 5).value byte ^= eight_bit_integer(state >> 3).value return byte