Commit b8e179fd authored by Katharina Fey's avatar Katharina Fey 🏴
Browse files

Trimming trailing \n

parent 152dba6f
......@@ -19,7 +19,9 @@ pub fn run(args: &ArgMatches<'_>) {
let string = String::from_utf8(data)
.unwrap_or_else(|_| utils::log_fatal("Provided invalid UTF-8 data!"));
println!("In: {}", string);
// Hash token twice with random salt
let token = utils::secret_to_verify(string, salt);
let token = utils::secret_to_verify(string.trim().into(), salt.trim());
println!("{}", token);
}
......@@ -45,7 +45,7 @@ fn index(state: web::Data<Params>, req: HttpRequest) -> HttpResponse {
.to_str()
.unwrap();
let hash = utils::secret_to_verify(token.into(), state.salt.as_str());
let hash = utils::secret_to_verify(token.trim().into(), state.salt.trim());
if utils::blake2_verify(state.token.clone(), hash) {
HttpResponse::Ok().body(format!("Done"))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment