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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ppdeep-20251115.tar.gz.
File metadata
- Download URL: ppdeep-20251115.tar.gz
- Upload date:
- Size: 4.4 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c6fdb5117b0eebfbe91a117b3c89f4de5d161a7a0c1a2d3023a065a676727b7c
|
|
| MD5 |
33de2f66dceee555885c6f927b1b6a28
|
|
| BLAKE2b-256 |
6a507a56c6309633f92f9e58ae60d76be5c1a01ade92ec33d49881eccff9b446
|
File details
Details for the file ppdeep-20251115-py3-none-any.whl.
File metadata
- Download URL: ppdeep-20251115-py3-none-any.whl
- Upload date:
- Size: 4.6 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
845c6b598ddcae0714992011cf856826690e3fd1c0bf80b38cecfaa9089c0d34
|
|
| MD5 |
8fc2e218202edadda8172cd42d6e727f
|
|
| BLAKE2b-256 |
79e63d549ea4bfa1ebbf3e0f8b8c18d5081026f24c9ff61c81e7603751bbd7a4
|