From 19a6131baa8b9fa69c1abc4eb0ee6054e289060e Mon Sep 17 00:00:00 2001 From: c3rb3r3u5d3d53c Date: Fri, 13 Dec 2024 20:28:46 -0400 Subject: [PATCH] readme [skip ci] --- README.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/README.md b/README.md index de46893d..2a8f2e66 100644 --- a/README.md +++ b/README.md @@ -1038,6 +1038,35 @@ for function in cfg.functions(): print(gene) ``` +#### Comparing Function Similarity + +One of the most powerful tools you can use in **binlex** is to compare functions, blocks, and instructions using similarity hashing. + +To perform these comparisons is as simple as calling the `compare` method. + +```python +for lhs in lhs_cfg.functions(): + for rhs in rhs_cfg.functions(): + similarity = lhs.compare(rhs) + similarity.print() + +for lhs in lhs_cfg.blocks(): + for rhs in rhs_cfg.blocks(): + similarity = lhs.compare(rhs) + similarity.print() + +for lhs in lhs_cfg.instructions(): + for rhs in rhs_cfg.instructions(): + similarity = lhs.compare(rhs) + similarity.print() +``` + +Any supported similarity hashing algorithms will be calcualted if they are enabled with your configuration. + +Although it can be challenging, **binlex** supports performing similarity analysis on non-contiguous functions using its own algorithm to find the best similarity matches. + +At least 75% or more of a non-contiguous function's data must be hashable to yield a similarity hash. + #### Accessing Genetic Properties Each instruction, block and function or **genome** has an associated chromosome which can be accessed via the API.