Skip to main content

A small tool to generate deterministic, pronounceable and memorable words from a given input

Project description

Mustache Donkey Pants

This is a small tool to generate deterministic, pronounceable and memorable words from a given input. Inspired by https://destructible.io/ and https://what3words.com/.

Install

pip install mdpants

Or:

git clone git@github.com:25A0/MustacheDonkeyPants.git
python setup.py develop

Usage

% echo 'Hello World!' > myfile
% mdpants myfile
Plottage.Hypoazoturia.Congresswomen

The output depends on the file content, not the filename:

% echo 'Thanks for all the fish!' > myfile
% mdpants myfile
Noncalculable.Cremationist.Somersetted
% echo 'Thanks for all the fish!' | mdpants -
Noncalculable.Cremationist.Somersetted

You can vary the number of words that the output is comprised of:

% echo 'Hello World' > myfile
% mdpants -N5 myfile
Plottage.Hypoazoturia.Congresswomen.Affiliable.Specks

You can specify a different list of words if you want:

% echo "foo\nbar\nbaz" > foolist
% echo 'Hello World!' | mdpants --in foolist -
Bar.Bar.Foo

It works with emoticons, too:

% echo 'Hello World!' > myfile
% mdpants --emoticons myfile
😳.😟.😍

To change the delimiter between words, use the -c option:

% echo 'Never gonna give you up' > myfile
% mdpants -c ' - ' myfile
Lings - Distractedness - Buhl

If you do want a result that is pseudorandomly generated, rather than deterministically, use the -R flag:

% mdpants -R
Unplagiarized.Cytotropism.Ravelings
% mdpants -R
Bismuthous.Fizzwater.Maxicoats

How it works

It’s embarrassingly simple:

  1. Hash the content of the given file

  2. Use that hash to seed a PRNG (for the non-deterministic version, the seed comes from os.urandom.)

  3. Use that seeded PRNG to get the indices of the N words

  4. Print out the concatenated words

Yes, you could probably do this in a bash script and it would work just fine. However, reading and writing the aligned word lists was easier in Python.

Aligned wordlists

Reading through more than 300,000 words can take a while. To speed things up, run make to produce a more efficient version of the word list. Then run mdpants with the --bin <file> option, like so:

% echo 'Hello World' > myfile
% mdpants --bin words.bin myfile

While the generation of the binary wordlist takes a while, and the resulting file is quite a bit larger than the original file, you will find that mdpants finishes much faster with the binary wordlists.

Words

The words used by this tool come from a mildly curated version of the _”Single”_ word list of the Moby project. The original list was released to the public domain in 1996, and contained 354,984 words. The modified version used in this project contains wc words.txt words.

What I’ve changed compared to the original list:

  • any line matching [^a-z\s] was removed

  • any single-letter words were removed

Thus, all words contain only a-z and have a length of at least 2.

But… why?

Here’s what I will use this tool for: I often share files by putting them in a folder on my server without access restriction. But I don’t want people to be able to see what else is lying around there. The content of that folder is not enumerable, but people could still try to guess filenames. Using the hash of the file as the filename would solve that, but those URLs would not be pronounceable. With Mustache Donkey Pants I can easily generate unique, memorable and pronounceable file names without having to worry about collisions or people guessing URLs.

Disclaimer

Although alias md5=mdpants --emoticons -N 16 sounds like a great idea, you really shouldn’t use this as a sort of weird replacement for a hash function.

Final note

I’ll buy you a beer if you find the file that produces Mustache.Donkey.Pants!

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

mdpants-0.8.9.tar.gz (2.4 MB view details)

Uploaded Source

Built Distribution

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

mdpants-0.8.9-py2-none-any.whl (2.4 MB view details)

Uploaded Python 2

File details

Details for the file mdpants-0.8.9.tar.gz.

File metadata

  • Download URL: mdpants-0.8.9.tar.gz
  • Upload date:
  • Size: 2.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for mdpants-0.8.9.tar.gz
Algorithm Hash digest
SHA256 eec2a2b8c083076f468c8a990787c8ad11abb7d56f6f85fb28d9e61b784f5abb
MD5 e5d350acbb091980b22a8ebe49c8b7ad
BLAKE2b-256 f18a7c160105f5eb35e2e9989e8c9acc9603921ec8a09e952b02d79297985902

See more details on using hashes here.

File details

Details for the file mdpants-0.8.9-py2-none-any.whl.

File metadata

File hashes

Hashes for mdpants-0.8.9-py2-none-any.whl
Algorithm Hash digest
SHA256 5d43c17f3f7d87d6538419edfe2d27ea50bca9236d642564e613dcaac617a953
MD5 69f6f6d288cebfe5abc00b737dc1d21e
BLAKE2b-256 50a3a332076e5f03dd17ed466fa6eea848991190e1b880edb348471ee1448a14

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