Skip to main content

image_digest

Function image_digest 

Source
pub fn image_digest(image: &[u8]) -> [u8; 32]
Expand description

Hashes a complete image, for a publisher filling in a manifest.

The manifest commits to a SHA-256 over the image, and this is that hash, so a publisher does not have to add a hashing crate of its own just to name the image it is releasing. A device receiving the image checks the same hash through ImageVerifier, which streams it rather than holding the whole image.

§Arguments

  • image - the complete image the release carries.

§Returns

The SHA-256 of image, ready to put in a Manifest.

§Examples

use pamoja_update::image_digest;

let digest = image_digest(b"firmware");
assert_eq!(digest.len(), 32);