[PATCH proxmox-backup v3 05/30] datastore: manifest: add helper for change detection fingerprint

Christian Ebner
2026-04-14T12:58:58Z

Generates a checksum over the file names and checksums of the manifest,
to be stored in the encrypted snapshots manifest when doing server side
sync push encryption. The fingerprint will then be used on pull to
detect if a manifests file contents did not change and are therefore
fine to be skipped (no resync required). The usual byte-wise comparison
is not feasible for this.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
---
changes since version 2:
- no changes

pbs-datastore/src/manifest.rs | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)

diff --git a/pbs-datastore/src/manifest.rs b/pbs-datastore/src/manifest.rs
index fb734a674..5f7d3efcc 100644
--- a/pbs-datastore/src/manifest.rs
+++ b/pbs-datastore/src/manifest.rs
@@ -236,6 +236,26 @@ impl BackupManifest {
}
Ok(Some(serde_json::from_value::<SnapshotVerifyState>(verify)?))
}
+
+ /// Set the fingerprint used to detect changes for encrypted -> decrypted syncs
+ pub fn set_change_detection_fingerprint(
+ &mut self,
+ fingerprint: &[u8; 32],
+ ) -> Result<(), Error> {
+ let fp_str = hex::encode(fingerprint);
+ self.unprotected["change-detection-fingerprint"] = serde_json::to_value(fp_str)?;
+ Ok(())
+ }
+
+ /// Generate the fingerprint used to detect changes for encrypted -> decrypted syncs
+ pub fn change_detection_fingerprint(&self) -> Result<[u8; 32], Error> {
+ let mut csum = openssl::sha::Sha256::new();
+ for file_info in self.files() {
+ csum.update(file_info.filename.as_bytes());
+ csum.update(&file_info.csum);
+ }
+ Ok(csum.finish())
+ }
}

impl TryFrom<super::DataBlob> for BackupManifest {
--
2.47.3