





from __future__ import annotations
class 	__magic_name__			:




					def __init__(       self	,   _a = 0						)			->					int:
							lowerCAmelCase_												=				key




					def 					__a     (       self	,   _a	,   _a						)			->					int:
							assert isinstance(snake_case__	,   snake_case__						) and isinstance(snake_case__	,   snake_case__						)

							lowerCAmelCase_												=				key or self.__key or 1

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

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




					def 					__a     (       self	,   _a	,   _a						)			->					List[str]:
							assert isinstance(snake_case__	,   snake_case__						) and isinstance(snake_case__	,   snake_case__						)

							lowerCAmelCase_												=				key or self.__key or 1

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

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




					def 					__a     (       self	,   _a	,   _a = 0						)			->					Optional[int]:
							assert isinstance(snake_case__	,   snake_case__						) and isinstance(snake_case__	,   snake_case__						)

							lowerCAmelCase_												=				key or self.__key or 1

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

							# This will be returned
							lowerCAmelCase_												=				''

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

							return ans




					def 					__a     (       self	,   _a	,   _a = 0						)			->					Any:
							assert isinstance(snake_case__	,   snake_case__						) and isinstance(snake_case__	,   snake_case__						)

							lowerCAmelCase_												=				key or self.__key or 1

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

							# This will be returned
							lowerCAmelCase_												=				''

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

							return ans




					def 					__a     (       self	,   _a	,   _a = 0						)			->					List[str]:
							assert isinstance(snake_case__	,   snake_case__						) and isinstance(snake_case__	,   snake_case__						)

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

							except OSError:
									return False

							return True




					def 					__a     (       self	,   _a	,   _a						)			->					str:
							assert isinstance(snake_case__	,   snake_case__						) and isinstance(snake_case__	,   snake_case__						)

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

							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")







def        __UpperCAmelCase						(							lowerCamelCase_ :     str  )       ->  bool:







			"""simple docstring"""





			SCREAMING_SNAKE_CASE_   : Any					  =      0
			for ch in input_str:
						SCREAMING_SNAKE_CASE_   : Union[str, Any]					  =      ord(lowerCamelCase_  )
						SCREAMING_SNAKE_CASE_   : Tuple					  =      pow(2  ,							lowerCamelCase_  )

						# If we already turned on bit for current character's unicode
						if bitmap >> ch_unicode & 1 == 1:
									return False
						bitmap |= ch_bit_index_on
			return True


if __name__ == "__main__":
						import doctest

						doctest.testmod()



