import hashlib, re, binascii
a = """d131dd02c5e6eec4693d9a0698aff95c 2fcab58712467eab4004583eb8fb7f89
55ad340609f4b30283e488832571415a 085125e8f7cdc99fd91dbdf280373c5b
d8823e3156348f5bae6dacd436c919c6 dd53e2b487da03fd02396306d248cda0
e99f33420f577ee8ce54b67080a80d1e c69821bcb6a8839396f9652b6ff72a70"""
b = """d131dd02c5e6eec4693d9a0698aff95c 2fcab50712467eab4004583eb8fb7f89
55ad340609f4b30283e4888325f1415a 085125e8f7cdc99fd91dbd7280373c5b
d8823e3156348f5bae6dacd436c919c6 dd53e23487da03fd02396306d248cda0
e99f33420f577ee8ce54b67080280d1e c69821bcb6a8839396f965ab6ff72a70"""
sa = re.sub("[\s|\n]", "", a)
sb = re.sub("[\s|\n]", "", b)
print('String binária 1:')
print(sa)
print('')
ha = hashlib.md5()
for i in range(0, len(sa), 2):
ha.update(binascii.a2b_hex(sa[i:i+2]))
print("Hash: " + ha.hexdigest())
print('')
print('String binária 2:')
print(sb)
print('')
hb = hashlib.md5()
for i in range(0, len(sb), 2):
hb.update(binascii.a2b_hex(sb[i:i+2]))
print("Hash: " + hb.hexdigest())
print('')
print('a == b ? ' + str(a == b))
print('MD5(a) == MD5(b) ? ' + str(ha.hexdigest() == hb.hexdigest()))
aW1wb3J0IGhhc2hsaWIsIHJlLCBiaW5hc2NpaQoKYSA9ICIiImQxMzFkZDAyYzVlNmVlYzQ2OTNkOWEwNjk4YWZmOTVjIDJmY2FiNTg3MTI0NjdlYWI0MDA0NTgzZWI4ZmI3Zjg5CjU1YWQzNDA2MDlmNGIzMDI4M2U0ODg4MzI1NzE0MTVhIDA4NTEyNWU4ZjdjZGM5OWZkOTFkYmRmMjgwMzczYzViCmQ4ODIzZTMxNTYzNDhmNWJhZTZkYWNkNDM2YzkxOWM2IGRkNTNlMmI0ODdkYTAzZmQwMjM5NjMwNmQyNDhjZGEwCmU5OWYzMzQyMGY1NzdlZThjZTU0YjY3MDgwYTgwZDFlIGM2OTgyMWJjY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