



'''simple docstring'''





def        _SCREAMING_SNAKE_CASE  (	UpperCamelCase							,   UpperCamelCase      ):



    """simple docstring"""





    lowerCAmelCase__			:  List[Any]											= """"""
    for i in table:
        res += inp[i - 1]
    return res
def        _SCREAMING_SNAKE_CASE  (	UpperCamelCase      ):



    """simple docstring"""





    return data[1:] + data[0]
def        _SCREAMING_SNAKE_CASE  (	UpperCamelCase							,   UpperCamelCase      ):



    """simple docstring"""





    lowerCAmelCase__			:  Optional[Any]											= """"""
    for i in range(len(UpperCamelCase      )      ):
        if a[i] == b[i]:
            res += "0"
        else:
            res += "1"
    return res
def        _SCREAMING_SNAKE_CASE  (	UpperCamelCase							,   UpperCamelCase      ):



    """simple docstring"""





    lowerCAmelCase__			:  Dict											= int("""0b""" + data[0] + data[-1]							,   2      )
    lowerCAmelCase__			:  Tuple											= int("""0b""" + data[1:3]							,   2      )
    return bin(s[row][col]      )[2:]
def        _SCREAMING_SNAKE_CASE  (	UpperCamelCase							,   UpperCamelCase							,   UpperCamelCase							,   UpperCamelCase							,   UpperCamelCase      ):



    """simple docstring"""





    lowerCAmelCase__			:  int											= message[:4]
    lowerCAmelCase__			:  int											= message[4:]
    lowerCAmelCase__			:  Tuple											= apply_table(UpperCamelCase							,   UpperCamelCase      )
    lowerCAmelCase__			:  List[str]											= xor(UpperCamelCase							,   UpperCamelCase      )
    lowerCAmelCase__			:  str											= apply_sbox(UpperCamelCase							,   temp[:4]      )  # noqa: E741
    lowerCAmelCase__			:  Optional[Any]											= apply_sbox(UpperCamelCase							,   temp[4:]      )
    lowerCAmelCase__			:  Union[str, Any]											= """0""" * (2 - len(UpperCamelCase      )) + l  # noqa: E741
    lowerCAmelCase__			:  List[str]											= """0""" * (2 - len(UpperCamelCase      )) + r
    lowerCAmelCase__			:  Optional[Any]											= apply_table(l + r							,   UpperCamelCase      )
    lowerCAmelCase__			:  Union[str, Any]											= xor(UpperCamelCase							,   UpperCamelCase      )
    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'''





import random
import unittest

import torch

from diffusers import IFInpaintingSuperResolutionPipeline
from diffusers.utils import floats_tensor
from diffusers.utils.import_utils import is_xformers_available
from diffusers.utils.testing_utils import skip_mps, torch_device

from ..pipeline_params import (
    TEXT_GUIDED_IMAGE_INPAINTING_BATCH_PARAMS,
    TEXT_GUIDED_IMAGE_INPAINTING_PARAMS,
)
from ..test_pipelines_common import PipelineTesterMixin
from . import IFPipelineTesterMixin






@skip_mps
class 	lowerCAmelCase_(    SCREAMING_SNAKE_CASE_						,			SCREAMING_SNAKE_CASE_						,			unittest.TestCase					):
  '''simple docstring'''




  __lowercase							:				List[str]           =				IFInpaintingSuperResolutionPipeline
  __lowercase							:				int           =				TEXT_GUIDED_IMAGE_INPAINTING_PARAMS - {'''width''', '''height'''}
  __lowercase							:				List[str]           =				TEXT_GUIDED_IMAGE_INPAINTING_BATCH_PARAMS.union({'''original_image'''}					)
  __lowercase							:				Optional[Any]           =				PipelineTesterMixin.required_optional_params - {'''latents'''}




  def 							UpperCAmelCase_     (   self				)   ->		Any:
      return self._get_superresolution_dummy_components()




  def 							UpperCAmelCase_     (   self  ,__UpperCAmelCase  ,__UpperCAmelCase=0				)   ->		List[Any]:
      if str(__UpperCAmelCase				).startswith("""mps"""				):
          lowerCAmelCase__			:  Any											= torch.manual_seed(__UpperCAmelCase				)
      else:
          lowerCAmelCase__			:  Dict											= torch.Generator(device=__UpperCAmelCase				).manual_seed(__UpperCAmelCase				)

      lowerCAmelCase__			:  Tuple											= floats_tensor((1, 3, 16, 16)  ,rng=random.Random(__UpperCAmelCase				)				).to(__UpperCAmelCase				)
      lowerCAmelCase__			:  Union[str, Any]											= floats_tensor((1, 3, 32, 32)  ,rng=random.Random(__UpperCAmelCase				)				).to(__UpperCAmelCase				)
      lowerCAmelCase__			:  Any											= floats_tensor((1, 3, 32, 32)  ,rng=random.Random(__UpperCAmelCase				)				).to(__UpperCAmelCase				)

      lowerCAmelCase__			:  Dict											= {
          """prompt""": """A painting of a squirrel eating a burger""",
          """image""": image,
          """original_image""": original_image,
          """mask_image""": mask_image,
          """generator""": generator,
          """num_inference_steps""": 2,
          """output_type""": """numpy""",
      }

      return inputs




  @unittest.skipIf(
      torch_device != """cuda""" or not is_xformers_available()  ,reason="""XFormers attention is only available with CUDA and `xformers` installed"""  ,)
  def 							UpperCAmelCase_     (   self				)   ->		Union[str, Any]:
      self._test_xformers_attention_forwardGenerator_pass(expected_max_diff=1E-3				)




  def 							UpperCAmelCase_     (   self				)   ->		Optional[int]:
      self._test_save_load_optional_components()




  @unittest.skipIf(torch_device != """cuda"""  ,reason="""float16 requires CUDA"""				)
  def 							UpperCAmelCase_     (   self				)   ->		List[Any]:
      # Due to non-determinism in save load of the hf-internal-testing/tiny-random-t5 text encoder
      super().test_save_load_floataa(expected_max_diff=1E-1				)




  def 							UpperCAmelCase_     (   self				)   ->		str:
      self._test_attention_slicing_forward_pass(expected_max_diff=1E-2				)




  def 							UpperCAmelCase_     (   self				)   ->		List[Any]:
      self._test_save_load_local()






  def 							UpperCAmelCase_     (   self				)   ->		int:
      self._test_inference_batch_single_identical(
          expected_max_diff=1E-2  ,)


