CodeNewbie Community 🌱

Cover image for @dicewarebot, the solution I needed that no one asked for
Kyle R. Conway
Kyle R. Conway

Posted on

@dicewarebot, the solution I needed that no one asked for

Originally published @ https://kylerconway.com/2020/08/21/dicewarebot-the-solution-i-needed-that-no-one-asked-for/

A number of years ago I was trying to learn python. Random numbers have always amused me (as I was recently reminded by a twitter nod to the weird usage of spreadsheets).

A user named @context_ing tweeted: “I love finding the ways in which people use spreadsheets. Personally, I use them for mostly budgeting, workout tracking and travel planning. Here’s a few in the wild I’ve found. Would love to see more! Please share if you’ve come across any or have any yourself.”

I felt compelled to reply with my own little story. “Reminds me of a decade old excel project. A playwriting book said something like “I guess it would be a play if you cut up words from a dictionary and pulled them out one-by-one, arranging them into lines of 10 words under character names, but it wouldn’t be a very good one.” So I took the entire public domain text of Oscar Wilde’s classic and had Excel recreate the play on every reopen of the file by randomly selecting words and character names I think using a vlookup and random. The result was interesting (and likely bad theatre).”

The text in question (blasted tweet limits!) was Oscar Wilde’s The Importance of Being Earnest. The resulting play was garbage, but that random integer generation was magical. When combined with other functions it really could do wonderful things for art.

Fast forward some (10?) years and I had a different problem to deal with: I needed to seamlessly transition all staff and clients from one grouping of technology services at one company to a different group of technology services at a new and different non-profit that was going to just continue doing basically the same work for basically the same people.

To remove almost all complexity from this story: I needed passwords; lots of random, unique, and strong passwords.

I once again turned to my friend the random number generator, but this time in python rather than excel. I coded up a script that would allow me to specify the number of words I wanted, unique separator I desired, and―importantly―how many of these unique passwords I wanted to be generated in one go.

I had the program roll digital dice and lookup words from the EFF’s Diceware password list and then spit them out. People would get their passwords and privately think I was just very adept at coming up with wacky sounding passwords, but I did not deserve this misconception as random integers were to blame for everything.

Eventually I thought it would be a good idea to create a sort of Public Service Announcement on the web about the odd truth that a list of words obtained by rolling dice really can be unique.

The end result is a Twitter bot and a Mastodon bot that very frequently tweet out unique passwords they’ve generated (though you probably shouldn’t use them). More people follow on Mastodon than Twitter, and Twitter relatively frequently blocks my bot’s tweets makes me unnecessarily prove that there’s a human behind the bot to get things going again (anyone at Twitter can explain this?).

At any rate, here’s some examples embedded below. Note that I also added the Harry Potter wordlist as well. There are others for your enjoyment on EFF’s site.

Lastly, there are infinitely better versions of this if you’re looking to generate a password. I’d recommend the much more easily installed passphraseme by Micah Lee.

#letsroll

⚄ ⚅ ⚁ ⚅ ⚁→#steed
⚄ ⚀ ⚄ ⚁ ⚀→#require
⚁ ⚀ ⚀ ⚅ ⚂→#cosmetics
⚀ ⚄ ⚃ ⚅ ⚂→#chevy
⚁ ⚃ ⚀ ⚂ ⚀→#doze
⚅ ⚁ ⚅ ⚄ ⚁→#truffle

steed-require-cosmetics-chevy-doze-truffle

Roll your own @ https://t.co/vIw88QUBey

— dicewarebot (@dicewarebot) August 21, 2020

At any rate, I hope you enjoyed my PSA.

Top comments (0)