refactor(utils): add hash verification functions

This commit is contained in:
RafayAhmad7548 2026-09-03 13:00:40 +05:00
parent 51722966e4
commit 6185a3123a
Signed by: RafayAhmad
SSH key fingerprint: SHA256:WURX8viobA1uawb4dWM3LqYrY+XPcZcXhAXAlrYdhtE
2 changed files with 16 additions and 7 deletions

View file

@ -47,3 +47,15 @@ where
result
}
pub fn verify_sha1(data: &[u8], expected_hex: &str) -> bool {
let mut hasher = Sha1::new();
hasher.update(data);
hex::encode(hasher.finalize()) == expected_hex
}
pub fn verify_sha512(data: &[u8], expected_hex: &str) -> bool {
let mut hasher = Sha512::new();
hasher.update(data);
hex::encode(hasher.finalize()) == expected_hex
}