crypto_hash

Function hex_digest

Source
pub fn hex_digest(algorithm: Algorithm, data: &[u8]) -> String
Expand description

Helper function for Hasher which generates a cryptographic digest serialized in hexadecimal from the given data and algorithm.

ยงExamples

use crypto_hash::{Algorithm, hex_digest};

let data = b"crypto-hash";
let result = hex_digest(Algorithm::SHA256, data);
let expected = "fd1afb6022cd4d47c890961c533928eacfe8219f1b2524f7fb2a61847ddf8c27";
assert_eq!(expected, result)