from hashlib import sha256 

inputs = [
     b"FOO-0x000000003B1BD2039" + b" " * 53 + b"\xdd\x3f\xf4\x6f",
     b"BAR-0x00000000307238E22" + b" " * 53 + b"\xa8\x0d\xa3\x23",
  b"FOOBAR-0x000000001BB6C4C9F" + b" " * 50 + b"\xb0\x1d\x7c\x21"
]

h = [sha256(x).digest() for x in inputs]
hh = [sha256(x).digest() for x in h]
xor = bytes([hh[0][i] ^ hh[1][i] ^ hh[2][i] for i in range(32)])

def format_hash(h):
    return " ".join(map(lambda b: "{:02x}".format(b), reversed(h)))

print('  {} = sha256({})'.format(format_hash(hh[0]), format_hash(h[0])))
print('^ {} = sha256({})'.format(format_hash(hh[1]), format_hash(h[1])))
print('^ {} = sha256({})'.format(format_hash(hh[2]), format_hash(h[2])))
print('  =====================================================')
print('  {}'.format(format_hash(xor)))
