






from __future__ import annotations

from typing import Dict

from ...configuration_utils import PretrainedConfig


__UpperCAmelCase     							=						{
    '''susnato/ernie-m-base_pytorch''': '''https://huggingface.co/susnato/ernie-m-base_pytorch/blob/main/config.json''',
    '''susnato/ernie-m-large_pytorch''': '''https://huggingface.co/susnato/ernie-m-large_pytorch/blob/main/config.json''',
}



class   lowerCamelCase				(A__      ):







		'''simple docstring'''



		_snake_case   :   Optional[Any]							=  'ernie_m'
		_snake_case   :   Dict[str, str]							=  {"dropout": "classifier_dropout", "num_classes": "num_labels"}



		def __init__(							self    ,		_UpperCamelCase = 2_5_0_0_0_2    ,		_UpperCamelCase = 7_6_8    ,		_UpperCamelCase = 1_2    ,		_UpperCamelCase = 1_2    ,		_UpperCamelCase = 3_0_7_2    ,		_UpperCamelCase = "gelu"    ,		_UpperCamelCase = 0.1    ,		_UpperCamelCase = 0.1    ,		_UpperCamelCase = 5_1_4    ,		_UpperCamelCase = 0.02    ,		_UpperCamelCase = 1    ,		_UpperCamelCase = 1E-05    ,		_UpperCamelCase=None    ,		_UpperCamelCase=False    ,		_UpperCamelCase=0.0    ,		**_UpperCamelCase    ,		)     ->							Any:
							super().__init__(pad_token_id=lowerCamelCase__    ,		**lowerCamelCase__       )
							UpperCAmelCase_   :				Union[str, Any]						=						vocab_size
							UpperCAmelCase_   :				int						=						hidden_size
							UpperCAmelCase_   :				List[str]						=						num_hidden_layers
							UpperCAmelCase_   :				Tuple						=						num_attention_heads
							UpperCAmelCase_   :				str						=						intermediate_size
							UpperCAmelCase_   :				Union[str, Any]						=						hidden_act
							UpperCAmelCase_   :				List[str]						=						hidden_dropout_prob
							UpperCAmelCase_   :				List[str]						=						attention_probs_dropout_prob
							UpperCAmelCase_   :				Tuple						=						max_position_embeddings
							UpperCAmelCase_   :				Any						=						initializer_range
							UpperCAmelCase_   :				List[str]						=						layer_norm_eps
							UpperCAmelCase_   :				Dict						=						classifier_dropout
							UpperCAmelCase_   :				Union[str, Any]						=						is_decoder
							UpperCAmelCase_   :				Any						=						act_dropout














def 					lowercase__				(					__snake_case   :							Tuple					,	__snake_case   :							List[Any]  ):


					'''simple docstring'''


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




def 					lowercase__				(					__snake_case   :							Optional[int]  ):


					'''simple docstring'''


					return data[1:] + data[0]




def 					lowercase__				(					__snake_case   :							Union[str, Any]					,	__snake_case   :							Optional[int]  ):


					'''simple docstring'''


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




def 					lowercase__				(					__snake_case   :							Dict					,	__snake_case   :							Optional[int]  ):


					'''simple docstring'''


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




def 					lowercase__				(					__snake_case   :							Tuple					,	__snake_case   :							List[Any]					,	__snake_case   :							List[Any]					,	__snake_case   :							Optional[int]					,	__snake_case   :							str  ):


					'''simple docstring'''


					UpperCAmelCase_   :				Union[str, Any]						=						message[:4]
					UpperCAmelCase_   :				Optional[int]						=						message[4:]
					UpperCAmelCase_   :				Union[str, Any]						=						apply_table(__snake_case					,	__snake_case  )
					UpperCAmelCase_   :				Union[str, Any]						=						xor(__snake_case					,	__snake_case  )
					UpperCAmelCase_   :				Dict						=						apply_sbox(__snake_case					,	temp[:4]  )  # noqa: E741
					UpperCAmelCase_   :				Any						=						apply_sbox(__snake_case					,	temp[4:]  )
					UpperCAmelCase_   :				str						=						'0' * (2 - len(__snake_case  )) + l  # noqa: E741
					UpperCAmelCase_   :				int						=						'0' * (2 - len(__snake_case  )) + r
					UpperCAmelCase_   :				int						=						apply_table(l + r					,	__snake_case  )
					UpperCAmelCase_   :				int						=						xor(__snake_case					,	__snake_case  )
					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, 10, 9]
		__UpperCAmelCase     							=						[3, 5, 2, 7, 4, 10, 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)






