Skip to content
/ dictpw Public

Generate password from dictionary with BSD licensing and practices

License

Notifications You must be signed in to change notification settings

guijan/dictpw

Repository files navigation

Dictpw - generate password from dictionary

Dictpw randomly picks 4 words off a 7776-word dictionary and prints them with a dot between each word. This is the Diceware method of password generation from the command line.

Which of the following 2 passwords is easier to memorize?

computer.stuffy.dexterity.carve
J#2%Q*PDfNI

Analysis

A password scheme's security can be measured by the number of distinct passwords it can generate. To keep these incredibly large numbers intelligible, they're given as exponents of 2, or bits. dictpw's default password length can generate 7776^4 distinct passwords, or 52 bits of security. Based on very conservative estimates made using my calculator, a 100-day attempt to crack such a password with 500000 USD budget for hardware (not counting electricity and labor) would have a 25% chance of succeeding in 2024.

The reasoning for these numbers is included in the calculator's source code.

Example

$ build/dictpw
canary.gnat.uncross.waking
$ build/dictpw -n3
chummy.iguana.outsider

Compiling

Dictpw depends on Meson and a C compiler. Git is one method to acquire the source code. Some systems optionally depend on either libbsd or libobsd, if neither is present, libobsd is automatically downloaded and statically linked into dictpw.

Linux, macOS, other Unix systems, and HaikuOS

Acquire the source code with git and enter its directory:

$ git clone --depth 1 https://github.com/guijan/dictpw
$ cd dictpw

Compile the program:

$ meson setup build && meson compile -C build

The binary will be in build/dictpw.

Windows

Windows hosts optionally depend on Inno Setup in the $env:PATH to produce an installer.

MSYS2

Install MSYS2 and follow the installation instructions; make sure to read the MSYS2-Introduction page after completing the installation instructions-failure to do so may break your MSYS2 installation.

The instructions below are the same for the UCRT64 (x64 binaries) and MINGW32 (x86 binaries) environments. Other environments aren't supported for end users.

Install the dependencies:

foo@bar UCRT64 ~
$ winget install -e --id JRSoftware.InnoSetup
foo@bar UCRT64 ~
$ inno="$(cmd //c 'echo %ProgramFiles(x86)%' | cygpath -uf-)/Inno Setup 6/"
foo@bar UCRT64 ~
$ PATH="${PATH}:${inno}"
foo@bar UCRT64 ~
$ pacboys -S --noconfirm git: dos2unix: groff: gcc:p meson:p ninja:p

Acquire the source code with git and enter its directory:

foo@bar UCRT64 ~
$ git clone --depth 1 https://github.com/guijan/dictpw
foo@bar UCRT64 ~
$ cd dictpw

Compile the program and installer:

foo@bar UCRT64 ~/dictpw
$ meson setup build && meson compile installer -C build

The installer will be at build/setup-dictpw.exe, and the program itself will be at build/dictpw.exe.

Visual Studio

Open up powershell.exe and install the dependencies via Chocolatey:

PS C:\Users\foo> choco install -y groff innosetup meson git dos2unix
PS C:\Users\foo> refreshenv

Acquire the source code with git and enter its directory:

PS C:\Users\foo> git clone --depth 1 https://github.com/guijan/dictpw
PS C:\Users\foo> refreshenv
PS C:\Users\foo> cd dictpw

Compile the installer:

PS C:\Users\foo\dictpw> meson setup build && meson compile installer -C build

Windows documentation

The installer also installs the manual. Check dictpw.txt inside the installation directory.

Custom dictionary

By default, dictpw uses the EFF's long word list. You can specify a custom dictionary by setting the dict option with Meson. A dictionary is a file with one word per line.