28 releases (10 stable)

4.0.1 Aug 10, 2019
3.0.2 Apr 19, 2019
3.0.1 Mar 29, 2019
2.1.0 Nov 26, 2018
0.0.2 Mar 4, 2015

#5 in Cryptography

Download history 3199/week @ 2019-04-27 3123/week @ 2019-05-04 3559/week @ 2019-05-11 3747/week @ 2019-05-18 4019/week @ 2019-05-25 4465/week @ 2019-06-01 3525/week @ 2019-06-08 4118/week @ 2019-06-15 4579/week @ 2019-06-22 4290/week @ 2019-06-29 4928/week @ 2019-07-06 5372/week @ 2019-07-13 4658/week @ 2019-07-20 5352/week @ 2019-07-27 6230/week @ 2019-08-03

19,488 downloads per month
Used in 99 crates (71 directly)

Apache-2.0

15KB
231 lines

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 :-)

Usage

Add rpassword as a dependency in Cargo.toml:

[dependencies]
rpassword = "4.0"

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);
}

Contributors

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! 😃 ❤️

Dependencies

~31KB