Socket
Book a DemoInstallSign in
Socket

wordhash

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wordhash

Get a string of English words as a fingerprint of any input data

0.1.1
pipPyPI
Maintainers
1

wordhash

This project provides a command-line tool and a Python library to do this:

Given some arbitrary input data, output a fingerprint of that data in the form of a string of ordinary English words. If the input data changes even slightly, then the output will change completely.

It uses the EFF's large wordlist as a source of words.

Installation

pip install wordhash

Usage

Command-line interface (CLI)

$ wordhash -h
usage: wordhash [-h] [-w WORDLIST_PATH] [-l LENGTH]
                (-f FILE | -s STRING)

options:
  -h, --help            show this help message and exit
  -w WORDLIST_PATH, --wordlist WORDLIST_PATH
                        Path to a newline-delimted file containing
                        words to be used in the wordhash (default:
                        venv/lib64/python3.10/site-
                        packages/wordhash/data/wordlist.txt)
  -l LENGTH, --length LENGTH
                        Length of hash digest for this program to use
                        internally. Determines number of words in the
                        resulting wordhash. (default: 8)
  -f FILE, --file FILE  Path to file to use as input data (default:
                        None)
  -s STRING, --string STRING
                        String to use as input data (default: None)
$ wordhash -s 'the quick brown fox jumps over the lazy dog'
BackstabAuthenticDialDivingModifiedAbridge
$ echo -n 'the quick brown fox jumps over the lazy dog' > test.tx
t
$ wordhash -f test.txt 
BackstabAuthenticDialDivingModifiedAbridge

Python library

>>> import wordhash
>>> mydata = b'the quick brown fox jumps over the lazy dog'
>>> wordhash.wordhash(mydata)
'BackstabAuthenticDialDivingModifiedAbridge'

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.