

"""simple docstring"""



def  _snake_case     (    UpperCAmelCase_  :					List[Any]					,   UpperCAmelCase_  :					Tuple			):
					A__										=  ''''''
					for i in table:
										res += inp[i - 1]
					return res





def  _snake_case     (    UpperCAmelCase_  :					List[str]			):
					return data[1:] + data[0]





def  _snake_case     (    UpperCAmelCase_  :					int					,   UpperCAmelCase_  :					Optional[Any]			):
					A__										=  ''''''
					for i in range(len(lowerCAmelCase_			)			):
										if a[i] == b[i]:
															res += "0"
										else:
															res += "1"
					return res





def  _snake_case     (    UpperCAmelCase_  :					Optional[int]					,   UpperCAmelCase_  :					Union[str, Any]			):
					A__										=  int("""0b""" + data[0] + data[-1]					,   2			)
					A__										=  int("""0b""" + data[1:3]					,   2			)
					return bin(s[row][col]			)[2:]





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


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

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

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

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

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









"""simple docstring"""



# Copyright 2023 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from typing import TYPE_CHECKING

# rely on isort to merge the imports
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available


SCREAMING_SNAKE_CASE_					:	List[str]							  =						{'configuration_mra': ['MRA_PRETRAINED_CONFIG_ARCHIVE_MAP', 'MraConfig']}

try:
 if not is_torch_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 SCREAMING_SNAKE_CASE_					:	List[Any]							  =						[
     'MRA_PRETRAINED_MODEL_ARCHIVE_LIST',
     'MraForMaskedLM',
     'MraForMultipleChoice',
     'MraForQuestionAnswering',
     'MraForSequenceClassification',
     'MraForTokenClassification',
     'MraLayer',
     'MraModel',
     'MraPreTrainedModel',
 ]


if TYPE_CHECKING:
 from .configuration_mra import MRA_PRETRAINED_CONFIG_ARCHIVE_MAP, MraConfig

 try:
  if not is_torch_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_mra import (
      MRA_PRETRAINED_MODEL_ARCHIVE_LIST,
      MraForMaskedLM,
      MraForMultipleChoice,
      MraForQuestionAnswering,
      MraForSequenceClassification,
      MraForTokenClassification,
      MraLayer,
      MraModel,
      MraPreTrainedModel,
  )
else:
 import sys

 SCREAMING_SNAKE_CASE_					:	List[str]							  =						_LazyModule(__name__, globals()['__file__'], _import_structure)






