mrshw
Thin, ctypes-based Python bindings for the mrsh CLI tool. Implements the Bloom-filter–based similarity hashing algorithm originally proposed by Frank Breitinger and Harald Baier in their paper Similarity Preserving Hashing: Eligible Properties and a new Algorithm MRSH-v2 (da/sec Biometrics and Internet Security Research Group, Hochschule Darmstadt). Use Bloom-filter–based fingerprinting directly from Python with minimal overhead.
Installation
Install from PyPI:
pip install mrshw
Or directly from GitHub (tagged release v1.0.0):
pip install git+https://github.com/w4term3loon/mrsh.git@v1.0.0
Quick start
import mrsh
# Target
file = "file.bin"
# Generate hash
hash_path = mrsh.hash(file) # labeled: 'file.bin'
hash_binary = mrsh.hash(open(file, 'rb').read())
# Arbitrary binary data hash
hash_labeled_binary = mrsh.hash((b"cafebabe", data_name))
# Calculate similarity score
similarity_score = mrsh.diff(hash_path, hash_binary)
assert(similarity_score == 100)
# Create and compare hashes with metadata
fp1 = mrsh.Fingerprint("file1.bin")
fp2 = mrsh.Fingerprint("file2.bin")
similarity = fp1.compare(fp2)
# Batch operations
fpl = mrsh.FingerprintList()
fpl.add("file1.bin")
fpl.add("file2.bin")
results = fpl.compare_all(threshold=50)
License
- Wrapper code: MIT License. See the LICENSE file for full terms.
- Underlying C library: Apache License 2.0. See its repository license.
Release files for mrshw 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mrshw-1.0.0.tar.gz | 24.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mrshw-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size:48.0 kB
Release files / mrshw-1.0.0.tar.gz
| Download URL | mrshw-1.0.0.tar.gz |
|---|---|
| Size | 24.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9386053bb01c669fa0cb089f754342245ff6622d16f856a725a6b03116f7541d
|
|
BLAKE2b-256 checksum How to use checksums |
ccec90464f92ffe8a8f4a4cadd5df7f08eacc06451e195dcad23c69a3551fd73
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.3
|
Release files / mrshw-1.0.0-py3-none-any.whl
| Download URL | mrshw-1.0.0-py3-none-any.whl |
|---|---|
| Size | 23.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ea34d8571a74eee8cc6663368bf5cad99d7ac5389244b8c67aa86f637a2497f9
|
|
BLAKE2b-256 checksum How to use checksums |
60477a2cad7163f7681878613c1f4e6715e9f245dcdfa652e51a7771f61476a5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.3
|