conradkleinespel/rpassword

Cross platform Rust library to read a password in the terminal (Linux, BSD, MacOS, Windows, WASM).

Rust

284

252 commits

updated May 31, 2026

See the code

README

Rustastic Password

rpassword makes it easy to read passwords from Rust code in console applications on all platforms, Unix, Windows, WASM and more. It's similar to Linux's C function getpass() or Python's getpass module.

rpassword logo and headline

Usage

Add rpassword as a dependency in Cargo.toml:

[dependencies]
rpassword = "7.5"

Then use it in your code:

use std::io::{Cursor, Write};
use rpassword::{ConfigBuilder};

fn main() {
    // By default, reads and writes to the console, hides password as it is typed 
    let password = rpassword::prompt_password("Your password: ").unwrap();
    println!("Your password is {}", password);
    
    // Behavior is customizable to accommodate custom use-cases and testing
    // See documentation for more details
     let config = rpassword::ConfigBuilder::new()
         .input_data("my-password\n")
         .output_discard()
         .password_feedback_mask('*')
         .build();
    
     let password = rpassword::read_password_with_config(config).unwrap();
     println!("Your password is {}", password);
}

See examples and docs at https://docs.rs/rpassword.

See the upgrade path in UPGRADE.md.

License

The source code is released under the Apache 2.0 license.

getpass
password
rust

Significant stargazers

Xavier Van de Woestyne

366 followers · starred May 2026

pierwill

49 followers · starred Nov 2021

Lukas Kalbertodt

359 followers · starred Aug 2017

Brad Dunbar

238 followers · starred Oct 2025

conradkleinespel/rpassword

Cross platform Rust library to read a password in the terminal (Linux, BSD, MacOS, Windows, WASM).

Rust

284

252 commits

updated May 31, 2026

See the code

README

Rustastic Password

rpassword makes it easy to read passwords from Rust code in console applications on all platforms, Unix, Windows, WASM and more. It's similar to Linux's C function getpass() or Python's getpass module.

rpassword logo and headline

Usage

Add rpassword as a dependency in Cargo.toml:

[dependencies]
rpassword = "7.5"

Then use it in your code:

use std::io::{Cursor, Write};
use rpassword::{ConfigBuilder};

fn main() {
    // By default, reads and writes to the console, hides password as it is typed 
    let password = rpassword::prompt_password("Your password: ").unwrap();
    println!("Your password is {}", password);
    
    // Behavior is customizable to accommodate custom use-cases and testing
    // See documentation for more details
     let config = rpassword::ConfigBuilder::new()
         .input_data("my-password\n")
         .output_discard()
         .password_feedback_mask('*')
         .build();
    
     let password = rpassword::read_password_with_config(config).unwrap();
     println!("Your password is {}", password);
}

See examples and docs at https://docs.rs/rpassword.

See the upgrade path in UPGRADE.md.

License

The source code is released under the Apache 2.0 license.

getpass
password
rust

Significant stargazers

Xavier Van de Woestyne

366 followers · starred May 2026

pierwill

49 followers · starred Nov 2021

Lukas Kalbertodt

359 followers · starred Aug 2017

Brad Dunbar

238 followers · starred Oct 2025