Why is my program generating
thread 'main' panicked at 'called
Result::unwrap()
on anErr
value: ParseIntError { kind: InvalidDigit }', src/main.rs:68:54 note: run withRUST_BACKTRACE=1
environment variable to display a backtrace
when I enter the generated hash it panics instead of passing control to if {..}.
fn main() {
println!("Hello user! Please cast your input ");
let userinput: u64 = user_input();
let mut hasher_two = DefaultHasher::new();
let vecdata = [0x09, 0x06, 0xba, 0x67, 0x76];
hasher_two.write(&vecdata);
let final_check = hasher_two.finish();
if final_check == userinput {
correct_file_creation();
} else {
wrong_file_creation();
}
}
pub fn user_input() -> u64 {
let mut userinput = String::new();
std::io::stdin().read_line(&mut userinput).unwrap();
let userinputinteger: i32 = userinput.trim().parse().unwrap();
return userinputinteger as u64;
}