From fdf8ae9201ec02afb17775b09e6dda3e9bf5c696 Mon Sep 17 00:00:00 2001 From: timvisee Date: Tue, 12 Mar 2019 21:39:21 +0100 Subject: [PATCH] Use shorter passphrase words, make them less than 32-characters long --- src/cmd/arg/gen_passphrase.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/cmd/arg/gen_passphrase.rs b/src/cmd/arg/gen_passphrase.rs index de110ee..fa311bd 100644 --- a/src/cmd/arg/gen_passphrase.rs +++ b/src/cmd/arg/gen_passphrase.rs @@ -1,8 +1,15 @@ -use chbs; +use chbs::{ + config::BasicConfig, + prelude::*, + word::WordList, +}; use clap::Arg; use super::{CmdArg, CmdArgFlag}; +/// How many words the passphrase should consist of. +const PASSPHRASE_WORDS: usize = 5; + /// The passphrase generation argument. pub struct ArgGenPassphrase {} @@ -10,7 +17,10 @@ impl ArgGenPassphrase { /// Generate a cryptographically secure passphrase that is easily /// rememberable using diceware. pub fn gen_passphrase() -> String { - chbs::passphrase() + let mut config = BasicConfig::default(); + config.words = PASSPHRASE_WORDS; + config.word_provider = WordList::builtin_eff_general_short().sampler(); + config.to_scheme().generate() } }