Package: mdpants
Mustache Donkey PantsThis is a small tool to generate deterministic, pronounceable and memorable words from a given input.
Inspired byhttps://destructible.io/andhttps://what3words.com/.Installpip install mdpantsOr:git clone git@github.com:25A0/MustacheDonkeyPants.git
python setup.py developUsage% echo 'Hello World!' > myfile
% mdpants myfile
Plottage.Hypoazoturia.CongresswomenThe 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.SomersettedYou can vary the number of words that the output is comprised of:% echo 'Hello World' > myfile
% mdpants -N5 myfile
Plottage.Hypoazoturia.Congresswomen.Affiliable.SpecksYou can specify a different list of words if you want:% echo "foo\nbar\nbaz" > foolist
% echo 'Hello World!' | mdpants --in foolist -
Bar.Bar.FooIt works with emoticons, too:% echo 'Hello World!' > myfile
% mdpants --emoticons myfile
😳.😟.😍To change the delimiter between words, use the-coption:% echo 'Never gonna give you up' > myfile
% mdpants -c ' - ' myfile
Lings - Distractedness - BuhlIf you do want a result that is pseudorandomly generated, rather than
deterministically, use the-Rflag:% mdpants -R
Unplagiarized.Cytotropism.Ravelings
% mdpants -R
Bismuthous.Fizzwater.MaxicoatsHow it worksIt’s embarrassingly simple:Hash the content of the given fileUse that hash to seed a PRNG (for the non-deterministic version, the seed comes fromos.urandom.)Use that seeded PRNG to get the indices of theNwordsPrint out the concatenated wordsYes, 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 wordlistsReading through more than 300,000 words can take a while. To speed things up,
runmaketo 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 myfileWhile 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.WordsThe words used by this tool come from a mildly curated version of the
_”Single”_ word list of theMoby project. The original list was
released to the public domain in 1996, and contained 354,984 words. The
modified version used in this project containswc words.txtwords.What I’ve changed compared to the original list:any line matching[^a-z\s]was removedany single-letter words were removedThus, 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.DisclaimerAlthoughalias md5=mdpants--emoticons-N16sounds like a great idea, you
really shouldn’t use this as a sort of weird replacement for a hash function.Final noteI’ll buy you a beer if you find the file that producesMustache.Donkey.Pants!