Use shorter passphrase words, make them less than 32-characters long
This commit is contained in:
parent
9a27be259d
commit
fdf8ae9201
1 changed files with 12 additions and 2 deletions
|
@ -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()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue