pub struct DigestUtils;Expand description
Utilities for working with SHA256 digests in Docker context
Implementations§
Source§impl DigestUtils
impl DigestUtils
Sourcepub fn compute_sha256(data: &[u8]) -> String
pub fn compute_sha256(data: &[u8]) -> String
Compute SHA256 digest from byte data
Sourcepub fn compute_sha256_str(data: &str) -> String
pub fn compute_sha256_str(data: &str) -> String
Compute SHA256 digest from string data
Sourcepub fn compute_docker_digest(data: &[u8]) -> String
pub fn compute_docker_digest(data: &[u8]) -> String
Compute full Docker digest (with sha256: prefix) from byte data
Sourcepub fn compute_docker_digest_str(data: &str) -> String
pub fn compute_docker_digest_str(data: &str) -> String
Compute full Docker digest (with sha256: prefix) from string data
Sourcepub fn is_valid_sha256_hex(digest: &str) -> bool
pub fn is_valid_sha256_hex(digest: &str) -> bool
Validate SHA256 hex string (64 characters, all hex)
Sourcepub fn is_valid_docker_digest(digest: &str) -> bool
pub fn is_valid_docker_digest(digest: &str) -> bool
Validate full Docker digest format (sha256:xxxxx)
Sourcepub fn normalize_digest(digest: &str) -> Result<String>
pub fn normalize_digest(digest: &str) -> Result<String>
Normalize digest to full Docker format (add sha256: prefix if missing)
Sourcepub fn extract_hex_part(digest: &str) -> Result<&str>
pub fn extract_hex_part(digest: &str) -> Result<&str>
Extract SHA256 hex part from full Docker digest
Sourcepub fn is_empty_layer_digest(digest: &str) -> bool
pub fn is_empty_layer_digest(digest: &str) -> bool
Check if a digest represents an empty layer
Sourcepub fn empty_layer_digest() -> String
pub fn empty_layer_digest() -> String
Get the standard empty layer digest with full Docker format
Sourcepub fn verify_data_integrity(data: &[u8], expected_digest: &str) -> Result<()>
pub fn verify_data_integrity(data: &[u8], expected_digest: &str) -> Result<()>
Verify data matches expected digest
Sourcepub fn extract_digest_from_layer_path(layer_path: &str) -> Option<String>
pub fn extract_digest_from_layer_path(layer_path: &str) -> Option<String>
Extract digest from Docker layer path (various formats)
Sourcepub fn generate_path_based_digest(layer_path: &str) -> String
pub fn generate_path_based_digest(layer_path: &str) -> String
Generate a fallback digest from path when real digest cannot be extracted
Sourcepub fn format_digest_short(digest: &str) -> String
pub fn format_digest_short(digest: &str) -> String
Format digest for display (truncated for readability)
Sourcepub fn validate_digests(digests: &[&str]) -> Result<()>
pub fn validate_digests(digests: &[&str]) -> Result<()>
Batch validate multiple digests