I found this a bit too easy. My first solution worked well, and I didn’t learn anything new by attempting this challenge.

The Problem

XOR the first two numbers to produce the third:


The Solution

I used Python, which—like many programming languages—can execute a Bitwise XOR on any integer value. To leverage this ability, I converted the hexadecimal numbers to integers and XOR-ed them. I then converted the result back to a hexadecimal number again.

The Code

input_1 = "1c0111001f010100061a024b53535009181c"
input_2 = "686974207468652062756c6c277320657965"
expected = "746865206b696420646f6e277420706c6179"

# convert to decimal
decimal_1 = int(input_1, 16)
decimal_2 = int(input_2, 16)

# XOR the two decimals
decimal_result = decimal_1 ^ decimal_2

# convert the to decimal
hex_result = f"{decimal_result:x}"

print(hex_result == expected)
#=> True