From ecb96a16443a45b0ebd463e831be8ca3be9f7f61 Mon Sep 17 00:00:00 2001 From: Jordan Wiens Date: Mon, 30 Oct 2017 17:46:49 -0400 Subject: __hash__ for three types of basic blocks --- python/basicblock.py | 3 +++ python/lowlevelil.py | 3 +++ python/mediumlevelil.py | 3 +++ 3 files changed, 9 insertions(+) (limited to 'python') diff --git a/python/basicblock.py b/python/basicblock.py index 26db925d..66d96882 100644 --- a/python/basicblock.py +++ b/python/basicblock.py @@ -68,6 +68,9 @@ class BasicBlock(object): """Internal method used to instantiante child instances""" return BasicBlock(view, handle) + def __hash__(self): + return hash((self.start, self.end, self.arch.name)) + @property def function(self): """Basic block function (read-only)""" diff --git a/python/lowlevelil.py b/python/lowlevelil.py index 75a3f1ad..dfc5af5f 100644 --- a/python/lowlevelil.py +++ b/python/lowlevelil.py @@ -1733,6 +1733,9 @@ class LowLevelILBasicBlock(basicblock.BasicBlock): """Internal method by super to instantiante child instances""" return LowLevelILBasicBlock(view, handle, self.il_function) + def __hash__(self): + return hash((self.start, self.end, self.il_function)) + def LLIL_TEMP(n): return n | 0x80000000 diff --git a/python/mediumlevelil.py b/python/mediumlevelil.py index 07759a47..9167212a 100644 --- a/python/mediumlevelil.py +++ b/python/mediumlevelil.py @@ -893,3 +893,6 @@ class MediumLevelILBasicBlock(basicblock.BasicBlock): def _create_instance(self, view, handle): """Internal method by super to instantiante child instances""" return MediumLevelILBasicBlock(view, handle, self.il_function) + + def __hash__(self): + return hash((self.start, self.end, self.il_function)) -- cgit v1.3.1