


'''simple docstring'''
def    a__			(   lowerCAmelCase__    ,   lowerCAmelCase__		)       ->      List[str]:
    UpperCAmelCase__     :						int						=							''''''
    for i in table:
        res += inp[i - 1]
    return res





def    a__			(   lowerCAmelCase__		)       ->      str:
    return data[1:] + data[0]





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





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





def    a__			(   lowerCAmelCase__    ,   lowerCAmelCase__    ,   lowerCAmelCase__    ,   lowerCAmelCase__    ,   lowerCAmelCase__		)       ->      str:
    UpperCAmelCase__     :						Any						=							message[:4]
    UpperCAmelCase__     :						Dict						=							message[4:]
    UpperCAmelCase__     :						int						=							apply_table(lowerCAmelCase__    ,   lowerCAmelCase__		)
    UpperCAmelCase__     :						Optional[Any]						=							xor(lowerCAmelCase__    ,   lowerCAmelCase__		)
    UpperCAmelCase__     :						int						=							apply_sbox(lowerCAmelCase__    ,   temp[:4]		)  # noqa: E741
    UpperCAmelCase__     :						Any						=							apply_sbox(lowerCAmelCase__    ,   temp[4:]		)
    UpperCAmelCase__     :						int						=							'''0''' * (2 - len(lowerCAmelCase__		)) + l  # noqa: E741
    UpperCAmelCase__     :						Tuple						=							'''0''' * (2 - len(lowerCAmelCase__		)) + r
    UpperCAmelCase__     :						Tuple						=							apply_table(l + r    ,   lowerCAmelCase__		)
    UpperCAmelCase__     :						str						=							xor(lowerCAmelCase__    ,   lowerCAmelCase__		)
    return temp + right


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

  UpperCamelCase__          = [6, 3, 7, 4, 8, 5, 1_0, 9]
  UpperCamelCase__          = [3, 5, 2, 7, 4, 1_0, 1, 9, 8, 6]
  UpperCamelCase__          = [2, 4, 3, 1]
  UpperCamelCase__          = [2, 6, 3, 1, 4, 8, 5, 7]
  UpperCamelCase__          = [4, 1, 3, 5, 7, 2, 8, 6]
  UpperCamelCase__          = [4, 1, 2, 3, 2, 3, 4, 1]
  UpperCamelCase__          = [[1, 0, 3, 2], [3, 2, 1, 0], [0, 2, 1, 3], [3, 1, 3, 2]]
  UpperCamelCase__          = [[0, 1, 2, 3], [2, 0, 1, 3], [3, 0, 1, 0], [2, 1, 0, 3]]

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

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

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


'''simple docstring'''





import unittest

from transformers.testing_utils import CaptureStdout
from transformers.tools.python_interpreter import evaluate







def snake_case_     (					lowercase__		):
  return x + 2






class 							UpperCAmelCase_							(    unittest.TestCase				):

 '''simple docstring'''







 def 							UpperCamelCase  (					self		:  Optional[int] ):



   '''simple docstring'''




   UpperCAmelCase__      :					List[str]				       =							"x = 3"
   UpperCAmelCase__      :					List[str]				       =							{}
   UpperCAmelCase__      :					Tuple				       =							evaluate(snake_case__			,				{}			,				state=snake_case__ )
   assert result == 3
   self.assertDictEqual(snake_case__			,				{"x": 3} )

   UpperCAmelCase__      :					Any				       =							"x = y"
   UpperCAmelCase__      :					List[str]				       =							{"y": 5}
   UpperCAmelCase__      :					Dict				       =							evaluate(snake_case__			,				{}			,				state=snake_case__ )
   # evaluate returns the value of the last assignment.
   assert result == 5
   self.assertDictEqual(snake_case__			,				{"x": 5, "y": 5} )







 def 							UpperCamelCase  (					self		:  Union[str, Any] ):



   '''simple docstring'''




   UpperCAmelCase__      :					int				       =							"y = add_two(x)"
   UpperCAmelCase__      :					Tuple				       =							{"x": 3}
   UpperCAmelCase__      :					Union[str, Any]				       =							evaluate(snake_case__			,				{"add_two": add_two}			,				state=snake_case__ )
   assert result == 5
   self.assertDictEqual(snake_case__			,				{"x": 3, "y": 5} )

   # Won't work without the tool
   with CaptureStdout() as out:
     UpperCAmelCase__      :					Any				       =							evaluate(snake_case__			,				{}			,				state=snake_case__ )
   assert result is None
   assert "tried to execute add_two" in out.out







 def 							UpperCamelCase  (					self		:  List[str] ):



   '''simple docstring'''




   UpperCAmelCase__      :					Tuple				       =							"x = 3"
   UpperCAmelCase__      :					List[Any]				       =							{}
   UpperCAmelCase__      :					Tuple				       =							evaluate(snake_case__			,				{}			,				state=snake_case__ )
   assert result == 3
   self.assertDictEqual(snake_case__			,				{"x": 3} )







 def 							UpperCamelCase  (					self		:  Dict ):



   '''simple docstring'''




   UpperCAmelCase__      :					int				       =							"test_dict = {'x': x, 'y': add_two(x)}"
   UpperCAmelCase__      :					List[Any]				       =							{"x": 3}
   UpperCAmelCase__      :					int				       =							evaluate(snake_case__			,				{"add_two": add_two}			,				state=snake_case__ )
   self.assertDictEqual(snake_case__			,				{"x": 3, "y": 5} )
   self.assertDictEqual(snake_case__			,				{"x": 3, "test_dict": {"x": 3, "y": 5}} )







 def 							UpperCamelCase  (					self		:  List[str] ):



   '''simple docstring'''




   UpperCAmelCase__      :					int				       =							"x = 3\ny = 5"
   UpperCAmelCase__      :					Dict				       =							{}
   UpperCAmelCase__      :					Union[str, Any]				       =							evaluate(snake_case__			,				{}			,				state=snake_case__ )
   # evaluate returns the value of the last assignment.
   assert result == 5
   self.assertDictEqual(snake_case__			,				{"x": 3, "y": 5} )







 def 							UpperCamelCase  (					self		:  Union[str, Any] ):



   '''simple docstring'''




   UpperCAmelCase__      :					Dict				       =							"text = f'This is x: {x}.'"
   UpperCAmelCase__      :					Dict				       =							{"x": 3}
   UpperCAmelCase__      :					Dict				       =							evaluate(snake_case__			,				{}			,				state=snake_case__ )
   # evaluate returns the value of the last assignment.
   assert result == "This is x: 3."
   self.assertDictEqual(snake_case__			,				{"x": 3, "text": "This is x: 3."} )







 def 							UpperCamelCase  (					self		:  List[Any] ):



   '''simple docstring'''




   UpperCAmelCase__      :					List[str]				       =							"if x <= 3:\n    y = 2\nelse:\n    y = 5"
   UpperCAmelCase__      :					Dict				       =							{"x": 3}
   UpperCAmelCase__      :					Dict				       =							evaluate(snake_case__			,				{}			,				state=snake_case__ )
   # evaluate returns the value of the last assignment.
   assert result == 2
   self.assertDictEqual(snake_case__			,				{"x": 3, "y": 2} )

   UpperCAmelCase__      :					Optional[Any]				       =							{"x": 8}
   UpperCAmelCase__      :					str				       =							evaluate(snake_case__			,				{}			,				state=snake_case__ )
   # evaluate returns the value of the last assignment.
   assert result == 5
   self.assertDictEqual(snake_case__			,				{"x": 8, "y": 5} )







 def 							UpperCamelCase  (					self		:  str ):



   '''simple docstring'''




   UpperCAmelCase__      :					Optional[int]				       =							"test_list = [x, add_two(x)]"
   UpperCAmelCase__      :					Any				       =							{"x": 3}
   UpperCAmelCase__      :					Any				       =							evaluate(snake_case__			,				{"add_two": add_two}			,				state=snake_case__ )
   self.assertListEqual(snake_case__			,				[3, 5] )
   self.assertDictEqual(snake_case__			,				{"x": 3, "test_list": [3, 5]} )







 def 							UpperCamelCase  (					self		:  str ):



   '''simple docstring'''




   UpperCAmelCase__      :					str				       =							"y = x"
   UpperCAmelCase__      :					str				       =							{"x": 3}
   UpperCAmelCase__      :					Any				       =							evaluate(snake_case__			,				{}			,				state=snake_case__ )
   assert result == 3
   self.assertDictEqual(snake_case__			,				{"x": 3, "y": 3} )







 def 							UpperCamelCase  (					self		:  int ):



   '''simple docstring'''




   UpperCAmelCase__      :					Optional[int]				       =							"test_list = [x, add_two(x)]\ntest_list[1]"
   UpperCAmelCase__      :					List[Any]				       =							{"x": 3}
   UpperCAmelCase__      :					List[Any]				       =							evaluate(snake_case__			,				{"add_two": add_two}			,				state=snake_case__ )
   assert result == 5
   self.assertDictEqual(snake_case__			,				{"x": 3, "test_list": [3, 5]} )

   UpperCAmelCase__      :					Union[str, Any]				       =							"test_dict = {'x': x, 'y': add_two(x)}\ntest_dict['y']"
   UpperCAmelCase__      :					str				       =							{"x": 3}
   UpperCAmelCase__      :					Any				       =							evaluate(snake_case__			,				{"add_two": add_two}			,				state=snake_case__ )
   assert result == 5
   self.assertDictEqual(snake_case__			,				{"x": 3, "test_dict": {"x": 3, "y": 5}} )







 def 							UpperCamelCase  (					self		:  Union[str, Any] ):



   '''simple docstring'''




   UpperCAmelCase__      :					List[Any]				       =							"x = 0\nfor i in range(3):\n    x = i"
   UpperCAmelCase__      :					List[Any]				       =							{}
   UpperCAmelCase__      :					Any				       =							evaluate(snake_case__			,				{"range": range}			,				state=snake_case__ )
   assert result == 2
   self.assertDictEqual(snake_case__			,				{"x": 2, "i": 2} )



