inplace/inplace.rs
1// Copyright 2025 Steven Dee.
2//
3// This project is made available under a BSD-compatible license. See the
4// LICENSE file in the project root for details.
5//
6// The readpassphrase source and header are copyright 2000-2002, 2007, 2010
7// Todd C. Miller.
8
9use readpassphrase_3::{RppFlags, readpassphrase};
10use zeroize::Zeroizing;
11
12fn main() {
13 let mut buf = Zeroizing::new(vec![0u8; 256]);
14 let password = readpassphrase(
15 c"Password: ",
16 &mut buf,
17 RppFlags::FORCEUPPER | RppFlags::ECHO_ON,
18 )
19 .expect("failed reading passphrase");
20 println!("{password}");
21}