Skip to content

Repository files navigation

Diceware Build Go License Go Reference

A modern TUI-inspired Diceware passphrase generator written in Go with Lip Gloss.

Diceware Demo

Installation

Build From Source

$ go build -o diceware ./cmd/diceware
$ go install ./cmd/diceware

Docker

$ docker build -t diceware .

Verify Installation

$ diceware -version

Quick Start

Generate passphrases:

$ diceware -i wordlists/wordlist-basque-diceware.txt -n 7 -interval 2s

Join the words with something other than a space:

$ diceware -i wordlists/wordlist-basque-diceware.txt -sep - -plain
malko-beira-soldadu-plastifikatu-ekuazio-datxa

Usage

diceware -i <wordlist-file|-> [flags]
  -i          wordlist file, or - for stdin       (required)
  -n          number of passphrases to generate   (default 1)
  -w          number of words per passphrase      (default 6)
  -sep        string placed between words         (default " ")
  -interval   refresh interval in live mode       (default 5s)
  -once       generate once and exit              (default false)
  -plain      print only the passphrases and exit (default false)
  -version    print the version and exit
  -h          print help and exit

When standard output is not a terminal the live view is skipped and only the passphrases are printed, so a pipe or a redirect behaves like -plain without the flag. Colors follow NO_COLOR.

Library

The wordlist reader and the generator are importable without the CLI:

$ go get go.hasteful.org/diceware
package main

import (
	"fmt"

	"go.hasteful.org/diceware"
)

func main() {
	words, err := diceware.LoadWords("wordlists/wordlist-basque-diceware.txt")
	if err != nil {
		panic(err)
	}

	phrases, err := diceware.GenerateList(words, 1, 6, " ")
	if err != nil {
		panic(err)
	}
	fmt.Println(phrases[0])
}

Wordlists

If you're interested in using your own wordlists with diceware, the EFF wordlists are a good starting point:

$ curl -fsSL https://www.eff.org/files/2016/07/18/eff_large_wordlist.txt | diceware -i - -w 6 -plain
freeing dispose unaware amicably implosion wieldable

Motivation

https://xkcd.com/936/

License

Licensed under the MIT License. See LICENSE for details.

Copyright (c) 2026-present hasteful

About

A modern TUI-inspired Diceware passphrase generator written in Go with Lip Gloss.

Topics

Resources

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages