Make the hash function for generic case

pull/971/head
Nikhil Parasaram 6 years ago
parent 02534db7bd
commit 31f3a4a5c3
  1. 3
      mythril/support/support_utils.py

@ -31,9 +31,10 @@ def get_code_hash(code):
:param code: bytecode
:return: Returns hash of the given bytecode
"""
code = code[2:] if code[:2] == "0x" else code
try:
keccak = sha3.keccak_256()
keccak.update(bytes.fromhex(code[2:]))
keccak.update(bytes.fromhex(code))
return "0x" + keccak.hexdigest()
except ValueError:
log.debug("Unable to change the bytecode to bytes. Bytecode: {}".format(code))

Loading…
Cancel
Save