Use shorter passphrase words, make them less than 32-characters long

This commit is contained in:
timvisee 2019-03-12 21:39:21 +01:00
parent 9a27be259d
commit fdf8ae9201
No known key found for this signature in database
GPG key ID: B8DB720BC383E172

View file

@ -1,8 +1,15 @@
use chbs; use chbs::{
config::BasicConfig,
prelude::*,
word::WordList,
};
use clap::Arg; use clap::Arg;
use super::{CmdArg, CmdArgFlag}; use super::{CmdArg, CmdArgFlag};
/// How many words the passphrase should consist of.
const PASSPHRASE_WORDS: usize = 5;
/// The passphrase generation argument. /// The passphrase generation argument.
pub struct ArgGenPassphrase {} pub struct ArgGenPassphrase {}
@ -10,7 +17,10 @@ impl ArgGenPassphrase {
/// Generate a cryptographically secure passphrase that is easily /// Generate a cryptographically secure passphrase that is easily
/// rememberable using diceware. /// rememberable using diceware.
pub fn gen_passphrase() -> String { 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()
} }
} }