Skip to main content

systemprompt_sync/diff/
mod.rs

1//! Pure-function diff calculators for content.
2//!
3//! Each calculator hashes the disk-side and database-side representations
4//! and emits a structured diff (`added`/`modified`/`removed`/`unchanged`)
5//! without mutating either side.
6//!
7//! Copyright (c) systemprompt.io — Business Source License 1.1.
8//! See <https://systemprompt.io> for licensing details.
9
10mod content;
11
12pub use content::ContentDiffCalculator;
13
14use sha2::{Digest, Sha256};
15
16pub fn compute_content_hash(body: &str, title: &str) -> String {
17    let mut hasher = Sha256::new();
18    hasher.update(title.as_bytes());
19    hasher.update(body.as_bytes());
20    hex::encode(hasher.finalize())
21}