Help us shape the future of Go! Take the 2026 Go Developer Survey

go-diceware

command module
v0.0.0-...-0c8d4e9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 21, 2018 License: MIT Imports: 3 Imported by: 0

README

Golang Diceware Generator

Build Status GoDoc

This library implements the Diceware algorithm in pure Golang. The algorithm is most-commonly used when generating human-readable passwords. You may be familiar with the XKCD comic.

The list of words are generated from the EFF's "long" list. However, the API's are abstracted so you can roll die and then use your own word list as-needed.

It uses crypto/rand for rolling die for added randomness.

Sample example words this library may choose:

squirt catchy anatomy storm
patchy replica scholar alkalize
operative shrank lying uncorrupt
confusion studio abstain subdivide chewy ouch password tropical pentagon

Installation

$ go get -u github.com/sethvargo/go-diceware

Usage

package main

import (
  "strings"

  "github.com/sethvargo/go-diceware/diceware"
)

func main() {
  // Generate 6 words using the diceware algorithm.
  list, err := diceware.Generate(6)
  if err != nil  {
    log.Fatal(err)
  }
  log.Printf(strings.Join(list, "-"))
}

See the GoDoc for more information.

License

This code is licensed under the MIT license.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Package diceware provides a library for generating random words via the diceware algorithm by rolling five six-sided dice to randomly select a word from a list of english words.
Package diceware provides a library for generating random words via the diceware algorithm by rolling five six-sided dice to randomly select a word from a list of english words.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL