Skip to main content

hash_sources

Function hash_sources 

Source
pub fn hash_sources(sources: &[&[u8]]) -> String
Expand description

Computes the canonical SHA-256 hex digest for a set of source bytes.

The digest covers every source’s full bytes in the order they appear in sources, with a 0x00 separator between sources so ["ab", "c"] and ["a", "bc"] produce distinct hashes. Sources are NOT sorted — callers must hand them in deterministic order.

§Examples

use ssg_core::hash_sources;

let a = hash_sources(&[b"hello", b"world"]);
let b = hash_sources(&[b"world", b"hello"]);
assert_eq!(a.len(), 64);
assert_ne!(a, b, "hash is order-sensitive");