Skip to content

Commit

Permalink
Generate passwords using Diceware
Browse files Browse the repository at this point in the history
Diceware passwords are easier to remember and communicate :
https://github.com/holizz/diceware/
via https://firstlook.org/theintercept/2015/03/26/passphrases-can-memorize-attackers-cant-guess/

We could improve the entropy per character by removing numbers and
symbols from the wordlist, and randomly adding them as delimiters
instead.
  • Loading branch information
burdges committed Mar 28, 2015
1 parent f64bec1 commit 0866fed
Show file tree
Hide file tree
Showing 7 changed files with 15,688 additions and 33 deletions.
22 changes: 22 additions & 0 deletions diceware/diceware.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package diceware

import (
"io"
"math/big"
"crypto/rand"
"strings"
)

func DicewareWords(r io.Reader, delim string, count int) string {
l := big.NewInt(int64( len(diceware_words) ));
words := []string{}
for i := 0; i < count; i++ {
j,err := rand.Int(r,l)
if err != nil {
panic("error reading from rand: " + err.Error())
}
words = append(words, diceware_words[j.Int64()])
}
return strings.Join(words, delim)
}

Binary file added diceware/diceware/diceware
Binary file not shown.
12 changes: 12 additions & 0 deletions diceware/diceware/diceware.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package main

import (
"fmt"
"crypto/rand"
"github.com/agl/pond/diceware"
)

func main() {
fmt.Println(diceware.DicewareWords(rand.Reader," ",6))
}

Loading

0 comments on commit 0866fed

Please sign in to comment.