def combine_zpk_clear_components(component1, component2): combined_key_bytes = bytearray(len(component1)) for i in range(len(combined_key_bytes)): combined_key_bytes[i] = component1[i] ^ component2[i] return combined_key_bytes def hex_string_to_byte_array(hex_string): length = len(hex_string) byte_array = bytearray(length // 2) for i in range(0, length, 2): byte_array[i // 2] = int(hex_string[i:i + 2], 16) return byte_array def byte_array_to_hex_string(byte_array): hex_string = "" for b in byte_array: hex_string += format(b, '02X') return hex_string def main(): zpk_component1 = "XXX" zpk_component2 = "YYY" try: zpk_component1_bytes = hex_string_to_byte_array(zpk_component1) zpk_component2_bytes = hex_string_to_byte_array(zpk_component2) combined_bytes = combine_zpk_clear_components(zpk_component1_bytes, zpk_component2_bytes) combined_zpk = byte_array_to_hex_string(combined_bytes) print("Combined ZPK:", combined_zpk) except Exception as e: print("Error:", e) if __name__ == "__main__": main()