Skip to main content

parse_sidecar

Function parse_sidecar 

Source
pub fn parse_sidecar(
    content: &str,
    filename: &str,
) -> Option<(ChecksumAlgorithm, String)>
Expand description

Scan a checksum sidecar file and return the (algorithm, hash) pair matching filename.

Understands two line formats:

  • GNU: <hash> <filename> or <hash> *<filename> (binary mode marker)
  • BSD: SHA256 (<filename>) = <hash>

filename is matched as a suffix so both bare names and paths work.