[][src]Crate mkpasswd

mkpasswd - Library and command-line tool to generate passwords

Command line tool

Install the command line tool with cargo install mkpasswd. You can then use the mkpasswd command, run it with --help to get more information.


The library exposes only a few functions dedicated to random password generation.

  • If you want it simple and can risk panics, use the mkpasswd function.

If you want more control and error handling, use generate and generate_with_rng. These functions take an alphabet, which is a set of characters that the password may contain.

  • The most control is offered by generate_with_rng, because it uses an external random number generator. You should this if you want to generate multiple passwords.


pub extern crate rand_core;
pub use alphabets::Password;



Commonly used alphabets for password generation.



Generates a length long password made of bytes from alphabet.


Generates a length long password made of bytes from alphabet using random data provided by rng.


Generates an UTF-8 valid password with a length of 32 characters.