Skip to content
weakishPublic

About

xkcd936 style passphrase generator.

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

45 Commits

Folders and files

Repository files navigation

Xkcd936

xkcd936 style passphrase generator with BIP39 word list.

Installation

Installation from the source requires Go installed on the system.

git clone https://github.com/weakish/xkcd936
cd xkcd936

Make

Build, then install. The default PREFIX in config.mk is /usr/local, so the binary is installed to /usr/local/bin. Run make before sudo make install so the build does not run as root.

make
sudo make install

PREFIX comes from config.mk or the make command line. The binary is installed to $(PREFIX)/bin. Use sudo only when that directory is not writable by your user.

make install PREFIX="$HOME/.local"

Uninstall with the same PREFIX, and with sudo when that directory is not writable:

sudo make uninstall
make uninstall PREFIX="$HOME/.local"

The Makefile is compatible with both GNU make and BSD make.

DoIt

It is also possible to use DoIt instead of make.

doit install

To change installation path (default to /usr/local/bin), run doit install --prefix /absolute/path instead.

Installing to or removing from the default path requires write permission to /usr/local/bin. To uninstall that install, run doit uninstall. For a user-local install, use a writable directory such as:

doit install --prefix "$HOME/.local/bin"

To uninstall a custom-prefix install, pass the same prefix:

doit uninstall --prefix "$HOME/.local/bin"

Usage

As a Commandline Utility

Example output:

; xkcd936
subway modify spoil basic

To fulfill password requirements from some websites (white space is not allowed and/or mix case is required), xkcd936 can also output titlized words:

; xkcd936 -t
AdvanceJealousDevelopSenior

By default, xkcd936 will generate four words, consistent with the [xkcd936] comic. -n sets the word count from 1 to 12. Any other count is an error.

By default, the BIP39 English word list is used. To use a BIP39 word list in another language, specify it in -l.

Some diceware-derived lists can also be used:

- `diceware{1,2,3,4}`: four lists split from [diceware8k], containing 2048 words each.
- `diceware2k`: [a wordlist derived from diceware8k][diceware2k], containing 2048 short words.

As a Library

import (
	"github.com/weakish/xkcd936/xkcd936"
)

// "en" selects the default English word list
var words []string = xkcd936.Words(4, "en") // e.g. []string{"cannon", "isolate", "soccer", "word"}
var phrase string = xkcd936.Phrase(words, true) // e.g. "CannonIsolateSoccerWord"

Notes

  • Output is a passphrase, not a wallet seed. Generation encodes 256 bits with the BIP39 mnemonic algorithm and returns only the first -n words (1–12), discarding the rest. The 24-word checksum is only in the last word, so a truncated phrase does not carry it. That phrase is not the mnemonic for the generated entropy and must not be used to seed a wallet.
  • Word count stops at 12 even though 256-bit entropy yields 24 words. The CLI rejects -n outside 1–12; Words clamps n>12 to 12. This is intentional: Bitcoin wallets treat ~128 bits (12 words) as enough. These 12 truncated words encode 132 bits of that entropy, so they are at a comparable level despite having no checksum.
  • Words mutates go-bip39's package-global word list and is serialized with a mutex; concurrent calls with different languages are safe but contend on that lock.

License

0BSD

About

xkcd936 style passphrase generator.

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages