algorithm_to_string

Function algorithm_to_string 

Source
pub fn algorithm_to_string(algorithm: &HashAlgorithm) -> &'static str
Expand description

Get the algorithm name as used in manifests

Converts a HashAlgorithm to its string representation for storage in manifests.

§Arguments

  • algorithm - The hash algorithm

§Returns

The algorithm name as a string:

  • HashAlgorithm::Sha256 → “sha256”
  • HashAlgorithm::Sha384 → “sha384”
  • HashAlgorithm::Sha512 → “sha512”

§Examples

use atlas_cli::hash::algorithm_to_string;
use atlas_c2pa_lib::cose::HashAlgorithm;

assert_eq!(algorithm_to_string(&HashAlgorithm::Sha256), "sha256");
assert_eq!(algorithm_to_string(&HashAlgorithm::Sha384), "sha384");
assert_eq!(algorithm_to_string(&HashAlgorithm::Sha512), "sha512");