Skip to main content

ctypes-based Python bindings for the mrsh CLI tool

Project description

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 v0.1.0b3):

pip install git+https://github.com/w4term3loon/mrsh.git@v0.1.0b3

Quickstart

import mrshw as mrsh

# 1. Single-fingerprint API
fp = mrsh.fp("path/to/file.bin")
print(str(fp))            # raw metadata + hex-encoded Bloom filters
print(fp.meta())          # Metadata(name, filesize, filter_count)

# 2. Quick hash helper
print(mrsh.hash("path/to/file.bin"))

# 3. Fingerprint-list API
fpl = mrsh.fpl()
fpl += "a.bin"
fpl += ("b.bin", "label_b")
fpl += open('c.bin', 'rb').read()
print(str(fpl))           # one line per fingerprint

# 4. Compare two fingerprints
cmp = mrsh.compare(fp, mrsh.fp("other.bin"))
print(cmp.hash1, cmp.hash2, cmp.score)

# 5. Compare all in a list
results = fpl.compare_all(threshold=10)
for comp in results:
    print(comp.hash1, comp.hash2, comp.score)

License

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

mrshw-0.1.0b3.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mrshw-0.1.0b3-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file mrshw-0.1.0b3.tar.gz.

File metadata

  • Download URL: mrshw-0.1.0b3.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for mrshw-0.1.0b3.tar.gz
Algorithm Hash digest
SHA256 a2c6544129a7da8f3b43580f30d49544f3ca0a8c5837900cb8d1fed5831c4a75
MD5 46d6b885429f7671b81393f9de182f92
BLAKE2b-256 498e8f2500bba3008dc57fb31341f228e1376c67e7fed9371135daa218fed8b3

See more details on using hashes here.

File details

Details for the file mrshw-0.1.0b3-py3-none-any.whl.

File metadata

  • Download URL: mrshw-0.1.0b3-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for mrshw-0.1.0b3-py3-none-any.whl
Algorithm Hash digest
SHA256 1218c518be33776ed125a25f0b47abc42002f948a220d25116ca7b56d1bbb64a
MD5 4120f25246e3d21c59a84964938a0b1b
BLAKE2b-256 99ddcfaa1f151bbac73e13ca46db4f1f28ca30ce73bda96445387d70d4cd3b94

See more details on using hashes here.

Supported by

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