





"""simple docstring"""






from __future__ import annotations




class 			__lowercase     :







     '''simple docstring'''




     def __init__(  self		,     _UpperCAmelCase = 0       ):
         __a	:  Union[str, Any]         =					key







     def 	_lowerCamelCase						(  self		,     _UpperCAmelCase		,     _UpperCAmelCase       ):
         assert isinstance(_UpperCAmelCase		,     _UpperCAmelCase       ) and isinstance(_UpperCAmelCase		,     _UpperCAmelCase       )

         __a	:  str         =					key or self.__key or 1

         # make sure key is an appropriate size
         key %= 255

         return [chr(ord(_UpperCAmelCase       ) ^ key       ) for ch in content]







     def 	_lowerCamelCase						(  self		,     _UpperCAmelCase		,     _UpperCAmelCase       ):
         assert isinstance(_UpperCAmelCase		,     _UpperCAmelCase       ) and isinstance(_UpperCAmelCase		,     _UpperCAmelCase       )

         __a	:  int         =					key or self.__key or 1

         # make sure key is an appropriate size
         key %= 255

         return [chr(ord(_UpperCAmelCase       ) ^ key       ) for ch in content]







     def 	_lowerCamelCase						(  self		,     _UpperCAmelCase		,     _UpperCAmelCase = 0       ):
         assert isinstance(_UpperCAmelCase		,     _UpperCAmelCase       ) and isinstance(_UpperCAmelCase		,     _UpperCAmelCase       )

         __a	:  Optional[int]         =					key or self.__key or 1

         # make sure key can be any size
         while key > 255:
             key -= 255

         # This will be returned
         __a	:  Union[str, Any]         =					''''''

         for ch in content:
             ans += chr(ord(_UpperCAmelCase       ) ^ key       )

         return ans







     def 	_lowerCamelCase						(  self		,     _UpperCAmelCase		,     _UpperCAmelCase = 0       ):
         assert isinstance(_UpperCAmelCase		,     _UpperCAmelCase       ) and isinstance(_UpperCAmelCase		,     _UpperCAmelCase       )

         __a	:  Dict         =					key or self.__key or 1

         # make sure key can be any size
         while key > 255:
             key -= 255

         # This will be returned
         __a	:  Any         =					''''''

         for ch in content:
             ans += chr(ord(_UpperCAmelCase       ) ^ key       )

         return ans







     def 	_lowerCamelCase						(  self		,     _UpperCAmelCase		,     _UpperCAmelCase = 0       ):
         assert isinstance(_UpperCAmelCase		,     _UpperCAmelCase       ) and isinstance(_UpperCAmelCase		,     _UpperCAmelCase       )

         try:
             with open(_UpperCAmelCase       ) as fin, open('''encrypt.out'''		,     '''w+'''       ) as fout:
                 # actual encrypt-process
                 for line in fin:
                     fout.write(self.encrypt_string(_UpperCAmelCase		,     _UpperCAmelCase       )       )

         except OSError:
             return False

         return True







     def 	_lowerCamelCase						(  self		,     _UpperCAmelCase		,     _UpperCAmelCase       ):
         assert isinstance(_UpperCAmelCase		,     _UpperCAmelCase       ) and isinstance(_UpperCAmelCase		,     _UpperCAmelCase       )

         try:
             with open(_UpperCAmelCase       ) as fin, open('''decrypt.out'''		,     '''w+'''       ) as fout:
                 # actual encrypt-process
                 for line in fin:
                     fout.write(self.decrypt_string(_UpperCAmelCase		,     _UpperCAmelCase       )       )

         except OSError:
             return False

         return True


# Tests
# crypt = XORCipher()
# key = 67

# # test encrypt
# print(crypt.encrypt("hallo welt",key))
# # test decrypt
# print(crypt.decrypt(crypt.encrypt("hallo welt",key), key))

# # test encrypt_string
# print(crypt.encrypt_string("hallo welt",key))

# # test decrypt_string
# print(crypt.decrypt_string(crypt.encrypt_string("hallo welt",key),key))

# if (crypt.encrypt_file("test.txt",key)):
#       print("encrypt successful")
# else:
#       print("encrypt unsuccessful")

# if (crypt.decrypt_file("encrypt.out",key)):
#       print("decrypt successful")
# else:
#       print("decrypt unsuccessful")






"""simple docstring"""






def       __A (     a_  :int				,    a_  :int)						->						str:
				if a < 0 or b < 0:
								raise ValueError('''the value of both inputs must be positive''')

				__a	:  Union[str, Any]         =					str(bin(a_))[2:]  # remove the leading "0b"
				__a	:  Union[str, Any]         =					str(bin(a_))[2:]  # remove the leading "0b"

				__a	:  Optional[Any]         =					max(len(a_)				,    len(a_))

				return "0b" + "".join(
				    str(int(char_a != char_b))
				    for char_a, char_b in zip(a_binary.zfill(a_)				,    b_binary.zfill(a_)))


if __name__ == "__main__":
		import doctest

		doctest.testmod()