Skip to content

Commit

Permalink
default to higher entropy output
Browse files Browse the repository at this point in the history
  • Loading branch information
Aizen committed Oct 7, 2024
1 parent 07d1f93 commit a1b0571
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
5 changes: 4 additions & 1 deletion cmd/genpw/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ type Passphrase struct {
}

func main() {
g := cryptipass.NewInstance()
f_pattern := flag.String("p", "W.w.w",
`pattern used to generate passphrase e.g. try:
-p WWW20dd
Expand All @@ -28,7 +27,11 @@ func main() {
- 's' symbol, 'd' digit.
`)
passwords := flag.Uint64("n", 6, "number of passwords to generate")
depth := flag.Uint64("d", 3, "markov chain depth, higher values lead to more plausible words but lower entropy")
flag.Parse()

g := cryptipass.NewCustomInstance(cryptipass.WordListEFF(), int(*depth))

pattern := *f_pattern

w := tabwriter.NewWriter(os.Stdout, 1, 1, 4, ' ', 0)
Expand Down
7 changes: 5 additions & 2 deletions cryptipass.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ import (
// If the random seed cannot be read from the crypto/rand source, the function
// will log a fatal error and terminate the application.
func NewCustomInstance(tokens []string, chain_depth int) *Generator {
if chain_depth < 1 {
panic("chain depths cannot be below 1")
}
rng := new_chacha8_rng()
g := new(Generator)
g.Rng = rng
Expand Down Expand Up @@ -83,8 +86,8 @@ func NewInstance() *Generator {
var global_jump_table Generator

func init() {
global_jump_table.depth = 3
global_jump_table.jump_table = distill(WordListEFF(), 3)
global_jump_table.depth = 2
global_jump_table.jump_table = distill(WordListEFF(), 2)
}

// GenPassphrase generates a passphrase composed of a specified number of words.
Expand Down

0 comments on commit a1b0571

Please sign in to comment.