Add Error when logging errors
This commit is contained in:
parent
34dab49bf4
commit
5edac13e00
1 changed files with 4 additions and 4 deletions
|
@ -1,5 +1,5 @@
|
||||||
use colog;
|
use colog;
|
||||||
use log::info;
|
use log::{info, error};
|
||||||
use num_bigint::BigUint;
|
use num_bigint::BigUint;
|
||||||
use num_primes::Generator;
|
use num_primes::Generator;
|
||||||
use num_traits::cast::ToPrimitive;
|
use num_traits::cast::ToPrimitive;
|
||||||
|
@ -71,14 +71,14 @@ fn main() {
|
||||||
colog::init();
|
colog::init();
|
||||||
info!("RSA Encryption/Decryption");
|
info!("RSA Encryption/Decryption");
|
||||||
info!("Enter a message to encrypt:");
|
info!("Enter a message to encrypt:");
|
||||||
|
|
||||||
let mut message: String = "".to_string();
|
let mut message: String = "".to_string();
|
||||||
match io::stdin().read_line(&mut message) {
|
match io::stdin().read_line(&mut message) {
|
||||||
Ok(n) => match n {
|
Ok(n) => match n {
|
||||||
0 => info!("No input provided"),
|
0 => info!("No input provided"),
|
||||||
_ => info!("{} bytes read", n),
|
_ => info!("{} bytes read", n),
|
||||||
},
|
},
|
||||||
Err(error) => println!("error: {error}"),
|
Err(error) => error!("error: {error}"),
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut rsa_size: String = "".to_string();
|
let mut rsa_size: String = "".to_string();
|
||||||
|
@ -89,7 +89,7 @@ fn main() {
|
||||||
0 => info!("No input provided"),
|
0 => info!("No input provided"),
|
||||||
_ => info!("{} bytes read", n),
|
_ => info!("{} bytes read", n),
|
||||||
},
|
},
|
||||||
Err(error) => println!("error: {error}"),
|
Err(error) => error!("error: {error}"),
|
||||||
}
|
}
|
||||||
|
|
||||||
let rsa = RSA::new(rsa_size.trim().parse().unwrap());
|
let rsa = RSA::new(rsa_size.trim().parse().unwrap());
|
||||||
|
|
Loading…
Add table
Reference in a new issue