fork download
  1. import hashlib, re, binascii
  2.  
  3. a = """d131dd02c5e6eec4693d9a0698aff95c 2fcab58712467eab4004583eb8fb7f89
  4. 55ad340609f4b30283e488832571415a 085125e8f7cdc99fd91dbdf280373c5b
  5. d8823e3156348f5bae6dacd436c919c6 dd53e2b487da03fd02396306d248cda0
  6. e99f33420f577ee8ce54b67080a80d1e c69821bcb6a8839396f9652b6ff72a70"""
  7.  
  8. b = """d131dd02c5e6eec4693d9a0698aff95c 2fcab50712467eab4004583eb8fb7f89
  9. 55ad340609f4b30283e4888325f1415a 085125e8f7cdc99fd91dbd7280373c5b
  10. d8823e3156348f5bae6dacd436c919c6 dd53e23487da03fd02396306d248cda0
  11. e99f33420f577ee8ce54b67080280d1e c69821bcb6a8839396f965ab6ff72a70"""
  12.  
  13. sa = re.sub("[\s|\n]", "", a)
  14. sb = re.sub("[\s|\n]", "", b)
  15.  
  16. print('String binária 1:')
  17. print(sa)
  18. print('')
  19. ha = hashlib.md5()
  20. for i in range(0, len(sa), 2):
  21. ha.update(binascii.a2b_hex(sa[i:i+2]))
  22. print("Hash: " + ha.hexdigest())
  23.  
  24. print('')
  25.  
  26. print('String binária 2:')
  27. print(sb)
  28. print('')
  29. hb = hashlib.md5()
  30. for i in range(0, len(sb), 2):
  31. hb.update(binascii.a2b_hex(sb[i:i+2]))
  32. print("Hash: " + hb.hexdigest())
  33.  
  34. print('')
  35.  
  36. print('a == b ? ' + str(a == b))
  37. print('MD5(a) == MD5(b) ? ' + str(ha.hexdigest() == hb.hexdigest()))
Success #stdin #stdout 0.03s 12456KB
stdin
Standard input is empty
stdout
String binária 1:
d131dd02c5e6eec4693d9a0698aff95c2fcab58712467eab4004583eb8fb7f8955ad340609f4b30283e488832571415a085125e8f7cdc99fd91dbdf280373c5bd8823e3156348f5bae6dacd436c919c6dd53e2b487da03fd02396306d248cda0e99f33420f577ee8ce54b67080a80d1ec69821bcb6a8839396f9652b6ff72a70

Hash: 79054025255fb1a26e4bc422aef54eb4

String binária 2:
d131dd02c5e6eec4693d9a0698aff95c2fcab50712467eab4004583eb8fb7f8955ad340609f4b30283e4888325f1415a085125e8f7cdc99fd91dbd7280373c5bd8823e3156348f5bae6dacd436c919c6dd53e23487da03fd02396306d248cda0e99f33420f577ee8ce54b67080280d1ec69821bcb6a8839396f965ab6ff72a70

Hash: 79054025255fb1a26e4bc422aef54eb4

a == b           ? False
MD5(a) == MD5(b) ? True