diff --git a/lib/src/backend.rs b/lib/src/backend.rs index 76779804b34..edc81b31851 100644 --- a/lib/src/backend.rs +++ b/lib/src/backend.rs @@ -114,11 +114,11 @@ impl ContentHash for MergedTreeId { fn hash(&self, state: &mut impl digest::Update) { match self { MergedTreeId::Legacy(tree_id) => { - state.update(b"0"); + state.update(&0u32.to_le_bytes()); ContentHash::hash(tree_id, state); } MergedTreeId::Merge(tree_ids) => { - state.update(b"1"); + state.update(&1u32.to_le_bytes()); ContentHash::hash(tree_ids, state); } } diff --git a/lib/src/content_hash.rs b/lib/src/content_hash.rs index 8f5d67a3a71..5b25797db0b 100644 --- a/lib/src/content_hash.rs +++ b/lib/src/content_hash.rs @@ -76,9 +76,9 @@ impl ContentHash for String { impl ContentHash for Option { fn hash(&self, state: &mut impl digest::Update) { match self { - None => state.update(&[0]), + None => state.update(&0u32.to_le_bytes()), Some(x) => { - state.update(&[1]); + state.update(&0u32.to_le_bytes()); x.hash(state) } }