






'''simple docstring'''



def 							lowercase_				(    __A :       Tuple					,      __A :       str			)       ->      Union[str, Any]:



 """simple docstring"""




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





def 							lowercase_				(    __A :       Tuple			)       ->      Union[str, Any]:



 """simple docstring"""




 return data[1:] + data[0]





def 							lowercase_				(    __A :       Any					,      __A :       List[str]			)       ->      int:



 """simple docstring"""




 lowercase					:   Union[str, Any]				  =''''''
 for i in range(len(lowerCAmelCase_			)			):
  if a[i] == b[i]:
   res += "0"
  else:
   res += "1"
 return res





def 							lowercase_				(    __A :       Optional[int]					,      __A :       Optional[Any]			)       ->      Union[str, Any]:



 """simple docstring"""




 lowercase					:   Dict				  =int('''0b''' + data[0] + data[-1]					,      2			)
 lowercase					:   Union[str, Any]				  =int('''0b''' + data[1:3]					,      2			)
 return bin(s[row][col]			)[2:]





def 							lowercase_				(    __A :       Optional[Any]					,      __A :       int					,      __A :       Union[str, Any]					,      __A :       Optional[Any]					,      __A :       str			)       ->      str:



 """simple docstring"""




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


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

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

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

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

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











'''simple docstring'''



from typing import List, Optional, Tuple

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_herbert import HerbertTokenizer


SCREAMING_SNAKE_CASE						=	logging.get_logger(__name__)

SCREAMING_SNAKE_CASE						=	{'vocab_file': 'vocab.json', 'merges_file': 'merges.txt', 'tokenizer_file': 'tokenizer.json'}

SCREAMING_SNAKE_CASE						=	{
    'vocab_file': {
        'allegro/herbert-base-cased': 'https://huggingface.co/allegro/herbert-base-cased/resolve/main/vocab.json'
    },
    'merges_file': {
        'allegro/herbert-base-cased': 'https://huggingface.co/allegro/herbert-base-cased/resolve/main/merges.txt'
    },
}

SCREAMING_SNAKE_CASE						=	{'allegro/herbert-base-cased': 514}
SCREAMING_SNAKE_CASE						=	{}
class UpperCAmelCase_					(    __A				):




      """simple docstring"""




      UpperCamelCase_								=			VOCAB_FILES_NAMES
      UpperCamelCase_								=			PRETRAINED_VOCAB_FILES_MAP
      UpperCamelCase_								=			PRETRAINED_INIT_CONFIGURATION
      UpperCamelCase_								=			PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
      UpperCamelCase_								=			HerbertTokenizer






      def __init__( self			:		Dict     ,      UpperCAmelCase			:		Optional[Any]=None     ,      UpperCAmelCase			:		Optional[int]=None     ,      UpperCAmelCase			:		Any=None     ,      UpperCAmelCase			:		Tuple="<s>"     ,      UpperCAmelCase			:		List[Any]="<unk>"     ,      UpperCAmelCase			:		str="<pad>"     ,      UpperCAmelCase			:		Optional[Any]="<mask>"     ,      UpperCAmelCase			:		List[str]="</s>"     ,      **UpperCAmelCase			:		List[str]     ,      )  ->  Dict:


       '''simple docstring'''

       super().__init__(
           UpperCAmelCase     ,      UpperCAmelCase     ,      tokenizer_file=UpperCAmelCase     ,      cls_token=UpperCAmelCase     ,      unk_token=UpperCAmelCase     ,      pad_token=UpperCAmelCase     ,      mask_token=UpperCAmelCase     ,      sep_token=UpperCAmelCase     ,      **UpperCAmelCase     ,      )






      def 				A__      ( self			:		int     ,      UpperCAmelCase			:		List[int]     ,      UpperCAmelCase			:		Optional[List[int]] = None		)  ->  List[int]:


       '''simple docstring'''

       lowercase					:   List[Any]				  =[self.cls_token_id]
       lowercase					:   Any				  =[self.sep_token_id]
       if token_ids_a is None:
        return cls + token_ids_a + sep

       return cls + token_ids_a + sep + token_ids_a + sep






      def 				A__      ( self			:		Any     ,      UpperCAmelCase			:		List[int]     ,      UpperCAmelCase			:		Optional[List[int]] = None     ,      UpperCAmelCase			:		bool = False		)  ->  List[int]:


       '''simple docstring'''

       if already_has_special_tokens:
        return super().get_special_tokens_mask(
            token_ids_a=UpperCAmelCase     ,      token_ids_a=UpperCAmelCase     ,      already_has_special_tokens=UpperCAmelCase		)

       if token_ids_a is None:
        return [1] + ([0] * len(UpperCAmelCase		)) + [1]
       return [1] + ([0] * len(UpperCAmelCase		)) + [1] + ([0] * len(UpperCAmelCase		)) + [1]






      def 				A__      ( self			:		Optional[int]     ,      UpperCAmelCase			:		List[int]     ,      UpperCAmelCase			:		Optional[List[int]] = None		)  ->  List[int]:


       '''simple docstring'''

       lowercase					:   Optional[Any]				  =[self.sep_token_id]
       lowercase					:   Dict				  =[self.cls_token_id]

       if token_ids_a is None:
        return len(cls + token_ids_a + sep		) * [0]
       return len(cls + token_ids_a + sep		) * [0] + len(token_ids_a + sep		) * [1]






      def 				A__      ( self			:		Union[str, Any]     ,      UpperCAmelCase			:		str     ,      UpperCAmelCase			:		Optional[str] = None		)  ->  Tuple[str]:


       '''simple docstring'''

       lowercase					:   List[Any]				  =self._tokenizer.model.save(UpperCAmelCase     ,      name=UpperCAmelCase		)
       return tuple(UpperCAmelCase		)



