Skip to main content

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.

Examples

Python

import os
import re

from hashpipe import Hashpipe

hashpipe = Hashpipe(
    pattern=re.compile(br"\bfox|dog\b"),
    algorithm="sha256",
    key=os.urandom(128),
)
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>.'

Shell

$ hashpipe --key=deadbeef --algorithm=md5 --prefix='{md5}' '^[^:]+' < /etc/passwd
<{md5}31572cc0e16e31b00f9888a18310ceab>:x:0:0:root:/root:/bin/bash
<{md5}1b4fa176c601aadfa5453b9074ba32d8>:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
...

Changes

0.9.2 (2020-01-12)

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

Release files for hashpipe 0.9.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hashpipe 0.9.2
File Size Uploaded
hashpipe-0.9.2.tar.gz 9.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hashpipe 0.9.2
File Interpreter ABI Platform
hashpipe-0.9.2-py3-none-any.whl Python 3 none any Details

Total release size: 18.9 kB

Release files / hashpipe-0.9.2.tar.gz

Download URL hashpipe-0.9.2.tar.gz
Size 9.3 kB
Tags Source
SHA-256 checksum
How to use checksums
c6628eaba3d9a4898ce9f7c9e800d2f18509ad734694a8056c3436e8904f8701
BLAKE2b-256 checksum
How to use checksums
a51960891c65261603ed24670f6ccfe135e2c48985e0e38766c465c5bfbb8e2a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.8.0

Release files / hashpipe-0.9.2-py3-none-any.whl

Download URL hashpipe-0.9.2-py3-none-any.whl
Size 9.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d21abe12ea15eabc2bf5c84b875112af4891e93e06703135e2a42efd6955142d
BLAKE2b-256 checksum
How to use checksums
ea2bb7b29598e76d82ef035ccf4e99c14f8ab49db605b0ece885d4604d97a325
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.8.0

Release history Release notifications | RSS feed

This release

0.9.2 This release

2 release files

0.9.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page