Skip to content
Snippets Groups Projects
Commit 6fbb59cd authored by vincent's avatar vincent
Browse files

Btc Machine

	* Fix: Reversing a hash function should always be considered as
imposible. The fix consists into parsing the ast tree in depth.
parent 4c79cfe8
No related branches found
No related tags found
No related merge requests found
......@@ -316,12 +316,17 @@ class BTCVector:
)
def is_result_of_hash(self):
z3_hash_functions = list(map(lambda v: v[0], HASH_FUNCTIONS.values()))
return self.val.decl() in z3_hash_functions
def parse_ast(e):
if e.decl().name() == "if":
return parse_ast(e.arg(1)) or parse_ast(e.arg(2))
else:
z3_hash_functions = list(map(lambda v: v[0], HASH_FUNCTIONS.values()))
return e.decl() in z3_hash_functions
return parse_ast(self.val)
def fetch_const_values(self):
def parse_ast(e):
n_args = e.num_args()
values = []
if is_int_value(e):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment