mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2025-05-20 07:26:58 -04:00
Add gpgui-helper (#326)
This commit is contained in:
14
crates/gpapi/src/utils/checksum.rs
Normal file
14
crates/gpapi/src/utils/checksum.rs
Normal file
@@ -0,0 +1,14 @@
|
||||
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(())
|
||||
}
|
Reference in New Issue
Block a user