/// Construct a new HashDescriptor by hashing the provided `image`.
Construct a new HashDescriptor by hashing the provided `image`.
Construct a new HashDescriptor by hashing the provided ` image ` .
pub fn new(image_name: &str, image: &[u8], salt: Salt) -> HashDescriptor {
        let header = HashDescriptorHeader::new(image_name, image);
        // Generate the digest with the salt prepended to the image.
        let mut salted_image: Vec<u8> = Vec::new();
        salted_image.extend_from_slice(&salt.bytes);
        salted_image.extend_from_slice(image);
        let digest = Sha256::hash(&salted_image).bytes();
        Self { header, image_name: image_name.to_string(), salt, digest }
    }
pub fn new ( image_name : & str , image : & [ u8 ] , salt : Salt ) -> HashDescriptor { let header = HashDescriptorHeader :: new ( image_name , image ) ; // Generate the digest with the salt prepended to the image. let mut salted_image : Vec < u8 > = Vec :: new ( ) ; salted_image . extend_from_slice ( & salt . bytes ) ; salted_image . extend_from_slice ( image ) ; let digest = Sha256 :: hash ( & salted_image ) . bytes ( ) ; Self { header , image_name : image_name . to_string ( ) , salt , digest } }
Construct a new HashDescriptor by hashing the provided `image`.
Construct a new HashDescriptor by hashing the provided ` image ` .
image_name
&str
image
&[u8]
salt
Salt