diceware

package module
v0.0.0-...-a90d664 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2023 License: AGPL-3.0 Imports: 2 Imported by: 0

README

logo

Diceware

Go Report Card GoDoc License Latest Release

Diceware is a technique for generating strong, memorable passwords using dice to select words from a list. The Diceware method is based on the idea that each word in the list corresponds to a unique combination of five dice rolls, making it difficult for attackers to guess the password.

Diceware

The diceware library provided in this project allows you to generate diceware passwords using Go. The library includes functions for generating a list of words, a randomised list of words, and a map of words that corresponds to each possible combination of dice rolls.

Example
package main

import (
	"fmt"

	"github.com/8ff/diceware"
)

func main() {
	// Get a slice of words
	words := diceware.GetWords()
	fmt.Println("Number of entries:", len(words))

	// Get a randomised slice of words
	randomWords := diceware.GetRandomWords()
	fmt.Println("Number of entries in randomised list:", len(randomWords))

	// Get a map of words
	wordsMap := diceware.GetWordsMap()
	fmt.Println("Number of entries in words map:", len(wordsMap))
}

Pwgen

The pwgen tool located in cmd/pwgen provided in this project allows you to generate diceware passwords using the command line. pwgen demo

Installing pwgen
repo="diceware"; name="pwgen"; os=$(uname | tr '[:upper:]' '[:lower:]'); arch=$(uname -m); case $arch in x86_64) arch="amd64" ;; arm64) arch="arm64" ;; esac; url="https://github.com/8ff/${repo}/releases/download/latest/${name}.${os}.${arch}"; curl -L $url -o ${name} && chmod +x ${name}

Generating passwords

To generate a diceware password using the pwgen command-line tool, you can run the go run command followed by the path to the pwgen package and any options you want to use. By default, pwgen will generate a 6-word diceware password.

You can specify a different password length by using the -l or --length option followed by a number. For example, to generate a 10-word diceware password, you can run the following command:

cd cmd/pwgen
go run main.go -l 10

The resulting password will be printed to the console.

Documentation

Index

Constants

View Source
const RawList = `` /* 108799-byte string literal not displayed */

Variables

This section is empty.

Functions

func GetRandomWords

func GetRandomWords() []string

Function that returns a randomised slice of words from the word list

func GetWords

func GetWords() []string

Function that returns a slice of words from the word list from RawList

func GetWordsMap

func GetWordsMap() map[string]string

Function that returns a map of words from the RawList splitting it same wat as GetWords

Types

This section is empty.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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