Skip to main content

HashBinKit

Collection of utilities for hashing binary executables.

Relies on:

  • r2bagpipe: for loading, parsing and iterating binary data.
  • hexio: for reading/writing/printing hashes in hexadecimal form.

Usage

Currently, it requires binary data to be pre-cached with Bin2ML. Therefore you should have two paths:

  1. Your binary file / binaries folder
  2. The directory containing the raw cached data

TODO

Below is the intended functionality:

  • 1. Produce function-level hashes for all artefacts: For the first implementation store everything in CSV files. Order does not matter in scalar and graph artefacts. Scalar and graph hashes are computed both by frequency (features weighted by occurence) and presence (each different feature is hashed once).
    • 1.1. Scalar artefacts
      • 1.1.1. N. Instructions
      • 1.1.2. Stackframe size
      • 1.1.3. N. Variables
        • arguments
        • locals
        • locals + arguments
      • 1.1.4. CFG data
        • N. CFG Blocks
        • N. CFG Edges
        • cyclomatic complexity
      • 1.1.5. Function call-graph
        • indegree
        • outdegree
        • outputs indegree (oi)
        • inputs indegree (ii)
        • outputs outdegree (oo)
        • inputs outdegree (io)
    • 1.2. Sequence artefacts (frequency / presence)
      • 1.2.1. Assembly immediates
        • all
        • no references
        • no references + no values < 0x100
      • 1.2.2. Assembly mnemonic types
        • plain
        • canonicalised
      • 1.2.3. ESIL instructions
        • plain
        • stripped values
      • 1.2.4. References
        • read
        • write
        • execute
        • all
      • 1.2.5. Variable data types (stripped bitness)
        • arguments
        • locals
        • arguments + locals
    • 1.3. Graph artefacts (frequency / presence)
      • 1.3.1. Control Flow Graph (CFG)
        • traversal indexing (machoke one-hops)
        • reference labelling (r / w / x)
        • subgraphs adjacency (k-3, k-4, k-5)
        • indegree/outdegree (k-1, k-2, k-3, k-4, k-5)
      • 1.3.2. Function Call Graph (CG)
        • traversal indexing (machoke one-hops)
        • reference labelling (r / w)
        • subgraphs adjacency (k-3, k-4, k-5)
        • indegree/outdegree (k-1, k-2, k-3, k-4, k-5)
  • 2. Storage solution for hashes results A large amount of data will be produced, raw storage is not an option. Processing this data will require efficient data management. This is a hashing library though so any storage solution should prioritise portability over query efficiency. Downstream apps could use HashBinKit to read the output and store it in their DB.
    • 2.1. Stream FEATURE_TYPE, FUNC_ADDRESS, FEATURE_HASH tuples with a Python iterator directly from cached binary artefacts.
    • 2.2. Object-Relational Model to manage parquet dataset. Using parquet for lightweight compression and hierarchical de-duplication. Hierarchy follows structure FILE_HASH > FEATURE > FUNC_ADDRESS > HASH
      • 2.2.1. Ingest CSV files into single parquet file.
      • 2.2.2. Cached artefacts processed into feature hashes stored in parquet file.
      • 2.2.3. Stream FEATURE_TYPE, FUNC_ADDRESS, FEATURE_HASH tuples with a Python iterator from parquet file.

Metadata

Release files for hashbinkit 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hashbinkit 0.3.1
File Size Uploaded Provenance Actions
hashbinkit-0.3.1.tar.gz 36.9 kB Without provenance Details for hashbinkit-0.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hashbinkit 0.3.1
File Interpreter ABI Platform Actions
hashbinkit-0.3.1-py3-none-any.whl Python 3 none any Details for hashbinkit-0.3.1-py3-none-any.whl

Total release size: 72.6 kB

Release files / hashbinkit-0.3.1.tar.gz

Download URL hashbinkit-0.3.1.tar.gz
Size 36.9 kB
Tags Source
SHA-256 checksum
How to use checksums
a08c9a7a7006662b7b5fe50b5f84ca0f2faf343f24e2be1f7025a5ff3ddda8ff
BLAKE2b-256 checksum
How to use checksums
0656e40feba5a23dadaff0b34e8dd889009d8830a6c00e47b447a7f7e6d6edd6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.8

Release files / hashbinkit-0.3.1-py3-none-any.whl

Download URL hashbinkit-0.3.1-py3-none-any.whl
Size 35.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ed994c5f32270648309635ae7004753bd9f986dd3cf9009605efc4149f96e832
BLAKE2b-256 checksum
How to use checksums
8fdd1248b518a7604d5afb5bb00b76c09cc03f5741be2fd3a4f5c5e354f910d3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.8

Security for hashbinkit 0.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page