Skip to main content

memory_core/store/
dedup.rs

1pub fn normalize_content(content: &str) -> String {
2    content
3        .to_lowercase()
4        .split_whitespace()
5        .collect::<Vec<_>>()
6        .join(" ")
7}
8
9pub fn compute_hash(key: &str, scope: &str, value: &str) -> String {
10    let normalized = normalize_content(value);
11    let input = format!("{key}:{scope}:{normalized}");
12    blake3::hash(input.as_bytes()).to_hex().to_string()
13}