
"""simple docstring"""




def  _lowerCAmelCase		(		_UpperCamelCase ,				_UpperCamelCase						):






  """simple docstring"""



  _lowercase:			List[Any]       =     ''''''
  for i in table:
    res += inp[i - 1]
  return res




def  _lowerCAmelCase		(		_UpperCamelCase						):






  """simple docstring"""



  return data[1:] + data[0]




def  _lowerCAmelCase		(		_UpperCamelCase ,				_UpperCamelCase						):






  """simple docstring"""



  _lowercase:			Union[str, Any]       =     ''''''
  for i in range(len(lowerCAmelCase_						)						):
    if a[i] == b[i]:
      res += "0"
    else:
      res += "1"
  return res




def  _lowerCAmelCase		(		_UpperCamelCase ,				_UpperCamelCase						):






  """simple docstring"""



  _lowercase:			Dict       =     int('''0b''' + data[0] + data[-1] ,				2						)
  _lowercase:			Union[str, Any]       =     int('''0b''' + data[1:3] ,				2						)
  return bin(s[row][col]						)[2:]




def  _lowerCAmelCase		(		_UpperCamelCase ,				_UpperCamelCase ,				_UpperCamelCase ,				_UpperCamelCase ,				_UpperCamelCase						):






  """simple docstring"""



  _lowercase:			int       =     message[:4]
  _lowercase:			List[Any]       =     message[4:]
  _lowercase:			List[Any]       =     apply_table(lowerCAmelCase_ ,				lowerCAmelCase_						)
  _lowercase:			List[str]       =     xor(lowerCAmelCase_ ,				lowerCAmelCase_						)
  _lowercase:			Optional[Any]       =     apply_sbox(lowerCAmelCase_ ,				temp[:4]						)  # noqa: E741
  _lowercase:			List[str]       =     apply_sbox(lowerCAmelCase_ ,				temp[4:]						)
  _lowercase:			int       =     '''0''' * (2 - len(lowerCAmelCase_						)) + l  # noqa: E741
  _lowercase:			Dict       =     '''0''' * (2 - len(lowerCAmelCase_						)) + r
  _lowercase:			List[Any]       =     apply_table(l + r ,				lowerCAmelCase_						)
  _lowercase:			Dict       =     xor(lowerCAmelCase_ ,				lowerCAmelCase_						)
  return temp + right


if __name__ == "__main__":
  A__   :					Union[str, Any]							=   input('Enter 10 bit key: ')
  A__   :					Union[str, Any]							=   input('Enter 8 bit message: ')

  A__   :					str							=   [6, 3, 7, 4, 8, 5, 1_0, 9]
  A__   :					str							=   [3, 5, 2, 7, 4, 1_0, 1, 9, 8, 6]
  A__   :					Dict							=   [2, 4, 3, 1]
  A__   :					str							=   [2, 6, 3, 1, 4, 8, 5, 7]
  A__   :					Union[str, Any]							=   [4, 1, 3, 5, 7, 2, 8, 6]
  A__   :					List[str]							=   [4, 1, 2, 3, 2, 3, 4, 1]
  A__   :					Dict							=   [[1, 0, 3, 2], [3, 2, 1, 0], [0, 2, 1, 3], [3, 1, 3, 2]]
  A__   :					Optional[int]							=   [[0, 1, 2, 3], [2, 0, 1, 3], [3, 0, 1, 0], [2, 1, 0, 3]]

  # key generation
  A__   :					Dict							=   apply_table(key, paa_table)
  A__   :					Optional[int]							=   temp[:5]
  A__   :					Dict							=   temp[5:]
  A__   :					int							=   left_shift(left)
  A__   :					str							=   left_shift(right)
  A__   :					Dict							=   apply_table(left + right, pa_table)
  A__   :					str							=   left_shift(left)
  A__   :					str							=   left_shift(right)
  A__   :					List[str]							=   left_shift(left)
  A__   :					Union[str, Any]							=   left_shift(right)
  A__   :					Optional[Any]							=   apply_table(left + right, pa_table)

  # encryption
  A__   :					Tuple							=   apply_table(message, IP)
  A__   :					Dict							=   function(expansion, sa, sa, keya, temp)
  A__   :					List[Any]							=   temp[4:] + temp[:4]
  A__   :					Union[str, Any]							=   function(expansion, sa, sa, keya, temp)
  A__   :					Union[str, Any]							=   apply_table(temp, IP_inv)
  print('Cipher text is:', CT)

  # decryption
  A__   :					List[Any]							=   apply_table(CT, IP)
  A__   :					Union[str, Any]							=   function(expansion, sa, sa, keya, temp)
  A__   :					Optional[int]							=   temp[4:] + temp[:4]
  A__   :					Union[str, Any]							=   function(expansion, sa, sa, keya, temp)
  A__   :					Optional[Any]							=   apply_table(temp, IP_inv)
  print('Plain text after decypting is:', PT)


"""simple docstring"""




def  _lowerCAmelCase		(		_UpperCamelCase ,				_UpperCamelCase						):






  """simple docstring"""



  return number | (1 << position)




def  _lowerCAmelCase		(		_UpperCamelCase ,				_UpperCamelCase						):






  """simple docstring"""



  return number & ~(1 << position)




def  _lowerCAmelCase		(		_UpperCamelCase ,				_UpperCamelCase						):






  """simple docstring"""



  return number ^ (1 << position)




def  _lowerCAmelCase		(		_UpperCamelCase ,				_UpperCamelCase						):






  """simple docstring"""



  return ((number >> position) & 1) == 1




def  _lowerCAmelCase		(		_UpperCamelCase ,				_UpperCamelCase						):






  """simple docstring"""



  return int((number & (1 << position)) != 0						)


if __name__ == "__main__":
  import doctest

  doctest.testmod()
