Files
GlobalProtect-openconnect/crates/gpapi/src/utils/checksum.rs
Kevin Yue 47776d54d9 Improve packaging (#328)
* Add gpgui-helper (#326)

* Add packaging
2024-02-26 23:33:39 +08:00

15 lines
315 B
Rust

use std::path::Path;
use anyhow::bail;
pub fn verify_checksum(path: &str, expected: &str) -> anyhow::Result<()> {
let file = Path::new(&path);
let checksum = sha256::try_digest(&file)?;
if checksum != expected {
bail!("Checksum mismatch, expected: {}, actual: {}", expected, checksum);
}
Ok(())
}