s1 = "1c0111001f010100061a024b53535009181c"
s2 = "686974207468652062756c6c277320657965"
s3 = "746865206b696420646f6e277420706c6179"
def xor_strings(a,b)
return nil unless a.size == b.size
fst = a.to_i(16)
snd = b.to_i(16)
res = fst ^ snd
res.to_s(16)
end
# test
puts s3 == xor_strings(s1, s2)
czEgPSAiMWMwMTExMDAxZjAxMDEwMDA2MWEwMjRiNTM1MzUwMDkxODFjIgpzMiA9ICI2ODY5NzQyMDc0Njg2NTIwNjI3NTZjNmMyNzczMjA2NTc5NjUiCnMzID0gIjc0Njg2NTIwNmI2OTY0MjA2NDZmNmUyNzc0MjA3MDZjNjE3OSIKCmRlZiB4b3Jfc3RyaW5ncyhhLGIpCiAgcmV0dXJuIG5pbCB1bmxlc3MgYS5zaXplID09IGIuc2l6ZQogIGZzdCA9IGEudG9faSgxNikKICBzbmQgPSBiLnRvX2koMTYpCiAgcmVzID0gZnN0IF4gc25kCiAgcmVzLnRvX3MoMTYpCmVuZAoKIyB0ZXN0CnB1dHMgczMgPT0geG9yX3N0cmluZ3MoczEsIHMyKQ==