Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

Regular expression match hasher

Project description

hashpipe -- Regular expression match hasher

Python versions PyPI version Build status Test coverage

hashpipe is a command line tool and a Python library for hashing regular expression matches in input data.

Matches are hashed with their HMAC hex digests using a configurable key and digest algorithm, surrounded by angle brackets, and optionally prefixed with a configurable string within the brackets.

What gets hashed for each match depends on whether the regular expression contains capturing groups. If it doesn't, the entire match content is hashed. If it does, only content of the first capturing group is.

The command line tool operates as a pipe, reading standard input and outputting to standard output. It has optional shell completion support using argcomplete.



import os
import re

from hashpipe import Hashpipe

hashpipe = Hashpipe(
hashed = hashpipe.hash_matches(b"The quick brown fox jumps over the lazy dog.")
# hashed now contains something like:
# b'The quick brown <00adbe4c178e322e582e4e45c4989a204655c4b3960c0be298bc763e29dc738b> '
# b'jumps over the lazy <ee68954fe2f64931fb63756a5ecd1e22b90984c6b29fe3340b159dcff1f98244>.'


$ hashpipe --key=deadbeef --algorithm=md5 --prefix='{md5}' '^[^:]+' < /etc/passwd


0.9.2 (2020-01-12)

  • Add -A/--available-algorithms option for listing available algorithms
  • Add optional shell completion support using argcomplete

Project details

Download files

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

Files for hashpipe, version 0.9.2
Filename, size File type Python version Upload date Hashes
Filename, size hashpipe-0.9.2-py3-none-any.whl (9.6 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size hashpipe-0.9.2.tar.gz (9.3 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page