From 11121d4713abf886d95451eced880848eaf098ba Mon Sep 17 00:00:00 2001 From: Vika Date: Sun, 9 Jul 2023 01:41:25 +0300 Subject: password-hasher: print prompts to stderr --- kittybox-rs/examples/password-hasher.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kittybox-rs/examples/password-hasher.rs b/kittybox-rs/examples/password-hasher.rs index 2cba606..f11c591 100644 --- a/kittybox-rs/examples/password-hasher.rs +++ b/kittybox-rs/examples/password-hasher.rs @@ -3,8 +3,8 @@ use std::io::Write; use argon2::{Argon2, password_hash::{rand_core::OsRng, PasswordHasher, PasswordHash, PasswordVerifier, SaltString}}; fn main() -> std::io::Result<()> { - print!("Type a password: "); - std::io::stdout().flush().unwrap(); + eprint!("Type a password: "); + std::io::stderr().flush().unwrap(); let password = { let mut s = String::new(); std::io::stdin().read_line(&mut s)?; @@ -14,7 +14,7 @@ fn main() -> std::io::Result<()> { let salt = SaltString::generate(&mut OsRng); let argon2 = Argon2::default(); - println!("{}", password.trim()); + //eprintln!("{}", password.trim()); let password_hash = argon2.hash_password(password.trim().as_bytes(), &salt) .expect("Hashing a password should not error out") .serialize(); -- cgit 1.4.1