Skip to main content

verify_iso_integrity

Function verify_iso_integrity 

Source
pub fn verify_iso_integrity(
    path: &Path,
    callback: Option<&(dyn Fn(String) + Send + Sync)>,
) -> Result<(), Box<dyn Error + Send + Sync>>
Expand description

Verify the integrity of an ISO file by calculating its SHA-256 hash.

After download, this function calculates the SHA-256 checksum of the file and displays it for manual comparison with the source.

§Arguments

  • path - Path to the ISO file
  • callback - Optional callback for status messages

§Example

use kget::verify_iso_integrity;
use std::path::Path;

verify_iso_integrity(
    Path::new("ubuntu-22.04-desktop-amd64.iso"),
    Some(&|msg| println!("Status: {}", msg)),
).unwrap();

§Output

Prints the SHA256 hash to stdout and sends it via callback if provided.