

'''simple docstring'''






def 	_A  (					A__  ,       A__   ):






 """simple docstring"""



 __lowercase													=				''''''
 for i in table:
  res += inp[i - 1]
 return res


def 	_A  (					A__   ):






 """simple docstring"""



 return data[1:] + data[0]


def 	_A  (					A__  ,       A__   ):






 """simple docstring"""



 __lowercase													=				''''''
 for i in range(len(A__   )   ):
  if a[i] == b[i]:
   res += "0"
  else:
   res += "1"
 return res


def 	_A  (					A__  ,       A__   ):






 """simple docstring"""



 __lowercase													=				int('''0b''' + data[0] + data[-1]  ,       2   )
 __lowercase													=				int('''0b''' + data[1:3]  ,       2   )
 return bin(s[row][col]   )[2:]


def 	_A  (					A__  ,       A__  ,       A__  ,       A__  ,       A__   ):






 """simple docstring"""



 __lowercase													=				message[:4]
 __lowercase													=				message[4:]
 __lowercase													=				apply_table(A__  ,       A__   )
 __lowercase													=				xor(A__  ,       A__   )
 __lowercase													=				apply_sbox(A__  ,       temp[:4]   )  # noqa: E741
 __lowercase													=				apply_sbox(A__  ,       temp[4:]   )
 __lowercase													=				'''0''' * (2 - len(A__   )) + l  # noqa: E741
 __lowercase													=				'''0''' * (2 - len(A__   )) + r
 __lowercase													=				apply_table(l + r  ,       A__   )
 __lowercase													=				xor(A__  ,       A__   )
 return temp + right


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

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

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

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

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




'''simple docstring'''






def 	_A  (					A__   ):






 """simple docstring"""



 if not nums:  # Makes sure that the list is not empty
  raise ValueError('''List is empty'''   )

 __lowercase													=				sum(A__   ) / len(A__   )  # Calculate the average
 return sum(abs(x - average   ) for x in nums   ) / len(A__   )


if __name__ == "__main__":
 import doctest

 doctest.testmod()

