Skip to main content

Pure-Python library for computing fuzzy hashes (ssdeep)

Project description

ppdeep

This is a pure-Python library for computing context triggered piecewise hashes (CTPH), also called fuzzy hashes, or often ssdeep after the name of a popular tool. At a very high level, fuzzy hashing is a way to determine whether two inputs are similar, rather than identical. Fuzzy hashes are widely adopted in digital forensics and malware detection.

This implementation is based on SpamSum by Dr. Andrew Tridgell.

Usage

To compute a fuzzy hash, simply use hash() function:

>>> import ppdeep
>>> h1 = ppdeep.hash('The equivalence of mass and energy translates into the well-known E = mc²')
>>> h1
'3:RC0qYX4LBFA0dxEq4z2LRK+oCKI9VnXn:RvqpLB60dx8ilK+owX'
>>> h2 = ppdeep.hash('The equivalence of mass and energy translates into the well-known E = MC2')
>>> h2
'3:RC0qYX4LBFA0dxEq4z2LRK+oCKI99:RvqpLB60dx8ilK+oA'

To calculate level of similarity, use compare() function which returns an integer value from 0 to 100 (full match):

>>> ppdeep.compare(h1, h2)
34

Function hash_from_file() accepts a filename as argument and calculates the hash of the contents of the file:

>>> ppdeep.hash_from_file('.bash_history')
'1536:EXM36dG36x3KW732vOAcg3EP1qKlKozcK0z5G+lEPTssl/7eO7HOBF:tKlKozcWT0'

Installation

$ pip install ppdeep

If you want to use the latest version of the code, you can install it from Git:

$ git clone https://github.com/elceef/ppdeep.git
$ cd ppdeep
$ pip install .

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ppdeep-20250625.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

ppdeep-20250625-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file ppdeep-20250625.tar.gz.

File metadata

  • Download URL: ppdeep-20250625.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.12

File hashes

Hashes for ppdeep-20250625.tar.gz
Algorithm Hash digest
SHA256 b7da50e54ed9bd79326382b6f2f51f371816f0495a5233dee23a9469f87a2a78
MD5 3815c88d8d81854a0b131ccd63b5aff4
BLAKE2b-256 f274d328ee495bcf5f98ae2967fdce45e1ca4b73e8f253e24a61e50f7527d5d9

See more details on using hashes here.

File details

Details for the file ppdeep-20250625-py3-none-any.whl.

File metadata

  • Download URL: ppdeep-20250625-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.12

File hashes

Hashes for ppdeep-20250625-py3-none-any.whl
Algorithm Hash digest
SHA256 036bb492eb8b86bf5e44a4da91de938c6f1ff66b6f36622c3e03fb3738407eb6
MD5 a299c192d141519e9adcbbdd8d531537
BLAKE2b-256 285a0902990827e969a4e5a10e8b9ac7880b6eb90b71c8ad98cb0d51cc71dd43

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page