avoid allocations and skip the utf8 check on the hex string
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
futures-util = "0.3"
hex = "0.4"
hyper = "0.14"
+itertools = "0.10"
openssl = "0.10"
percent-encoding = "2"
serde = { version = "1.0", features = ["derive"] }
return true;
}
+ use itertools::Itertools;
let fp = match cert.digest(openssl::hash::MessageDigest::sha256()) {
Ok(fp) => fp,
Err(err) => {
let fp_string = fp_string
.as_bytes()
.chunks(2)
- .map(|v| std::str::from_utf8(v).unwrap())
- .collect::<Vec<&str>>()
+ .map(|v| unsafe { std::str::from_utf8_unchecked(v) })
.join(":");
let expected = expected.to_lowercase();