rpassword 3.0.2

Read passwords in console applications.

Rustastic Password

Build Status Build status

This Rust package allows you to safely read passwords from standard input in a console application.

You can build the documentation with cargo doc or view it online.

I'd appreciate feedback if you use this library :-)


Add rpassword as a dependency in Cargo.toml:

rpassword = "3.0.2"

Use rpassword within your code:

extern crate rpassword;

fn main() {
    // Prompt for a password on TTY (safest but not default for backwards compatibility)
    let pass = rpassword::read_password_from_tty(Some("Password: ")).unwrap();
    println!("Your password is {}", pass);
    // Prompt for a password on STDOUT
    let pass = rpassword::prompt_password_stdout("Password: ").unwrap();
    println!("Your password is {}", pass);

    // Prompt for a password on STDERR
    let pass = rpassword::prompt_password_stderr("Password: ").unwrap();
    println!("Your password is {}", pass);

    // Read a password without prompt
    let pass = rpassword::read_password().unwrap();
    println!("Your password is {}", pass);


We welcome contribution from everyone. Feel free to open an issue or a pull request at any time.

Here's a list of existing rpassword contributors:

Thank you very much for your help! :smiley: :heart: