Diceware is a way of generating harder to crack passwords [1].
You roll 5 dice, look up the number in a table and jot down the word you find there, by chaining a string of words together you create a hard to crack password that is easier to remember. The use of a table is time consuming so I thought I would try to create a box where I enter the dice number and it looks the word up for me.
The original table runs in at 7775 words [2] but there are now a couple of different word lists available.
The Electronic Frontier Foundation (EFF) [3] has produced a second list [4] with the aim of eliminating the more obscure words, words which sound alike and a variety of other quirks of the original table. The EFF also has 2 lists of short words requiring only 4 dice for each word [5][6].
I initially built and tested my program with the 5 dice words lists later modifying the code to handle the 2 EFF short words lists.
I have not tested any of the other words lists such as those in other languages.
Hardware:The project consists of an Arduino UNO a Deek robot data logging shield and LCD shield with buttons stacked together like a cake, there are no external connections to make.
I have removed pin 10 of my LCD keyboard shield as it is used by the data logging shield as chip select (CS) and also because it was faulty [8].
Note that the SD card shield shown in my photo's has a piezo sounder soldered into the prototype area, this component is not required for this project; it is an artefact from other projects I have done.
Software:The Diceware words lists are stored in text files on the SD card; the words lists referenced all store their data in the format of - number tab word newline.
There are 3 main parts to the code.
The buttons are handled by an interrupt driven chorded keyboard routine that I have used on many occasions. This allows the selection and incrementation of each dice and when they are set initiates the word lookup.
The search routine is handled by code I copied from an Auduino forum post by CatweazleNZ to search and retrieve data from CSV formatted files [7].
The display control is handled by a set of dedicated functions.
File preparation and program setup:First download one of the words lists [2][4][5][6].
The original words list [2] needs some modifications, as downloaded the list has a header and footer which need removing. The original file has an extension of.asc this cannot be read by the SD library so the file must be saved as a text file which will give it a.txt extension.
The EFF words lists have longer filename's than allowed by the Arduino SD library which limits filenames to 8 characters.
I altered the filenames as follows:
diceware.wordlist.asc to diceware.txt
eff_large_wordslist.txt to eff_l.txt
eff_short_wordslist_1.txt to eff_s.txt
eff_short_wordslist_2_0.txt to eff_s2.txt
I have coded those names into the program file, you should comment out all but the one you are using. (Search for my_filename=)
If you are using either of the 2 EFF short words lists you will need to set the value of MAX_DICE to 4.
Finally compile the sketch and download it to your Arduino.
Slow search time:The SD card library does not allow random access to the file contents on the card. The closer to the end of the file the number you want is the longer it will take to find. The extreme example is to find the word for the maximum value of 66666 in the long word list, this takes around 8 seconds. The search time for 6666 in the short words list is much quicker.
Functioning:Use the select button to move cursor between the dice numbers and use the down button to increment the number.
The number will be looked up and the word displayed on the LCD once you click select past the last dice.
Cycle through this process again to find the next word.
References:(Checked January 2021)
[1] Diceware page: http://world.std.com/~reinhold/diceware.html
[2] Diceware words list: https://theworld.com/~reinhold/diceware.wordlist.asc
[3] Electronic Frontier Foundation: https://www.eff.org/deeplinks/2016/07/new-wordlists-random-passphrases
[4] EFF long list: https://www.eff.org/files/2016/07/18/eff_large_wordlist.txt
[5] EFF 4 dice short words: https://www.eff.org/files/2016/09/08/eff_short_wordlist_1.txt
[6] EFF 4 dice long words: https://www.eff.org/files/2016/09/08/eff_short_wordlist_2_0.txt
[7] Source of csv file reader code: https://forum.arduino.cc/index.php?topic=231631.0
[8] LCD problem page: https://forum.arduino.cc/index.php?topic=96747.0
Comments