Function xkcd_password::generate_password_custom_dict[][src]

pub fn generate_password_custom_dict(word_count: usize, dict: &[&str]) -> String

Attempts to generate an xkcd-password given a words count and a custom dict.

Warning: This function doesn't protect against side-channel attacks.

This function doesn't check for duplicate words in the dict.

Panics

Panics if dict is in an invalid format.

Panics if you ask for too many words.

Examples

let res = xkcd_password::generate_password_custom_dict(4, &["Ia", "weanmeheno", "theshehimheryes"]);
// res is made up of the words "I" "a" "we" "an" "me" "he" "no" "the" "she" "him" "her" "yes"