Skip to main content

hashdd

pyhashdd is a library for building and using hash databases.

Installation

With all prerequisites installed, you can install pyhashdd with pip, the [all] extras directive will install everything to need for extended hashes like ssdeep and pysha3:

pip install hashdd[all]

Alternative Installations

Default Installation

By default, we don't want to assume you have all of the required prerequisites installed, so we just install the absolute bare minimum for you to use the library as an import.

pip install hashdd

Extended Hashes Installation

Many of our "extended" hashes are essentially wrappers around popular OS libraries. These libraries are OS-level dependencies that we dont want to force you to use. So but default we don't install them but give you the option to install them all if you'd like.

pip install hashdd[all]

Docker

Build the container from the git root:

docker build -t hashdd .

Create a directory to scan, and copy our sample.exe into it.

mkdir files_to_scan/
cp tests/data/sample.exe files_to_scan/

Mount files_to_scan/ and scan away!

docker run --rm -v "$PWD"/files_to_scan:/files_to_scan hashdd hashdd compute -d /files_to_scan

Prerequisites

Ubuntu

sudo apt-get install libfuzzy-dev libmhash-dev libffi-dev libssl-dev

OSX/Darwin Prerequisites

brew install ssdeep

hashddcli Examples

To recusively (-d goodfiles/) calculate the SHA256 hashes of files in the goodfiles/ directory and add those hashes to a new bloom filter (the bloom filter is stored in hashdd.bloom):

hashdd bloom -d goodfiles/

With the bloom filter created, the bloom option now compares calculated hashes to the bloom. To calculate the SHA256 hash of sample.exe (-f sample.exe) and check if it is within the bloom filter (bloom):

hashdd bloom -f sample.exe

To calculate (compute) all hashes (--all) and output them to the screen:

hashdd compute -f sample.exe --all

To calculate a specific hash type:

hashdd compute -f sample.exe -a md5w

Library Examples

To hash a file using all algorithms and features, then store the results in Mongo:

>>> from hashdd import hashdd
>>> h = hashdd(filename='sample.exe')
>>> from pymongo import MongoClient
>>> db = MongoClient().hashdd
>>> db.hashes.insert_one(h.result)

Testing

python -m unittest discover -s tests/

py-mhash and mhashlib

Back in 2017 we fixed an issue in py-mhash which was merged into the git repository, however this fix was not built as part of the distribution in PyPi. Rather then rely on the package maintainer any further, we've bundled in py-mhash with hashdd. Please see the py-mash license for copyright information.

Metadata

Release files for hashdd 0.0.27

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

Source distribution (sdist)

Source distribution for hashdd 0.0.27
File Size Uploaded Provenance Actions
hashdd-0.0.27.tar.gz 726.7 kB Without provenance Details for hashdd-0.0.27.tar.gz

Built distribution (wheel)

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

Total release size: 1.1 MB

Release files / hashdd-0.0.27.tar.gz

Download URL hashdd-0.0.27.tar.gz
Size 726.7 kB
Tags Source
SHA-256 checksum
How to use checksums
46572d12ccfe447872ac8bcee765bdcacb07dcf8a20282963355703bc6ee803a
BLAKE2b-256 checksum
How to use checksums
d0995bae8832860830a21e6e1759cffef1068989feae1d4436147b03d7bf06fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.9

Release files / hashdd-0.0.27-py3-none-any.whl

Download URL hashdd-0.0.27-py3-none-any.whl
Size 376.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
94a307489ad476c1d7259f5a84322a7f1add3a81f8e483797345dce75db26686
BLAKE2b-256 checksum
How to use checksums
ac0429f94cf5a3d147fa99f2ca950c9772e935b58742c5df2fea18b248dabcb6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.9

Security for hashdd 0.0.27

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