





"""simple docstring"""





def  __A   (_SCREAMING_SNAKE_CASE     ,   _SCREAMING_SNAKE_CASE			)					->Optional[Any]:





  """simple docstring"""


  lowerCAmelCase__			:int											=							''
  for i in table:
    res += inp[i - 1]
  return res
def  __A   (_SCREAMING_SNAKE_CASE			)					->Union[str, Any]:





  """simple docstring"""


  return data[1:] + data[0]
def  __A   (_SCREAMING_SNAKE_CASE     ,   _SCREAMING_SNAKE_CASE			)					->int:





  """simple docstring"""


  lowerCAmelCase__			:Dict											=							''
  for i in range(len(_SCREAMING_SNAKE_CASE			)			):
    if a[i] == b[i]:
      res += "0"
    else:
      res += "1"
  return res
def  __A   (_SCREAMING_SNAKE_CASE     ,   _SCREAMING_SNAKE_CASE			)					->str:





  """simple docstring"""


  lowerCAmelCase__			:Tuple											=							int('0b' + data[0] + data[-1]     ,   2			)
  lowerCAmelCase__			:Any											=							int('0b' + data[1:3]     ,   2			)
  return bin(s[row][col]			)[2:]
def  __A   (_SCREAMING_SNAKE_CASE     ,   _SCREAMING_SNAKE_CASE     ,   _SCREAMING_SNAKE_CASE     ,   _SCREAMING_SNAKE_CASE     ,   _SCREAMING_SNAKE_CASE			)					->str:





  """simple docstring"""


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


if __name__ == "__main__":
  __A											=		input("""Enter 10 bit key: """)
  __A											=		input("""Enter 8 bit message: """)

  __A											=		[6, 3, 7, 4, 8, 5, 10, 9]
  __A											=		[3, 5, 2, 7, 4, 10, 1, 9, 8, 6]
  __A											=		[2, 4, 3, 1]
  __A											=		[2, 6, 3, 1, 4, 8, 5, 7]
  __A											=		[4, 1, 3, 5, 7, 2, 8, 6]
  __A											=		[4, 1, 2, 3, 2, 3, 4, 1]
  __A											=		[[1, 0, 3, 2], [3, 2, 1, 0], [0, 2, 1, 3], [3, 1, 3, 2]]
  __A											=		[[0, 1, 2, 3], [2, 0, 1, 3], [3, 0, 1, 0], [2, 1, 0, 3]]

  # key generation
  __A											=		apply_table(key, paa_table)
  __A											=		temp[:5]
  __A											=		temp[5:]
  __A											=		left_shift(left)
  __A											=		left_shift(right)
  __A											=		apply_table(left + right, pa_table)
  __A											=		left_shift(left)
  __A											=		left_shift(right)
  __A											=		left_shift(left)
  __A											=		left_shift(right)
  __A											=		apply_table(left + right, pa_table)

  # encryption
  __A											=		apply_table(message, IP)
  __A											=		function(expansion, sa, sa, keya, temp)
  __A											=		temp[4:] + temp[:4]
  __A											=		function(expansion, sa, sa, keya, temp)
  __A											=		apply_table(temp, IP_inv)
  print("""Cipher text is:""", CT)

  # decryption
  __A											=		apply_table(CT, IP)
  __A											=		function(expansion, sa, sa, keya, temp)
  __A											=		temp[4:] + temp[:4]
  __A											=		function(expansion, sa, sa, keya, temp)
  __A											=		apply_table(temp, IP_inv)
  print("""Plain text after decypting is:""", PT)







"""simple docstring"""





def  __A   (_SCREAMING_SNAKE_CASE     ,   _SCREAMING_SNAKE_CASE			)					->bool:





  """simple docstring"""


  return numa ^ numa < 0


if __name__ == "__main__":
  import doctest

  doctest.testmod()
