Skip to main content

encrypt_repo

Function encrypt_repo 

Source
pub fn encrypt_repo(repo: &'static Repo, paths: &[PathBuf]) -> Result<()>
Expand description

Encrypt given files in the repo. If no paths are given, encrypt all files in the repo’s crypt list.

§Deterministic Re-encryption

Loads the salt+file_id cache (populated by a previous decrypt) via mmap + rkyv zero-copy and reuses cached values so that decrypt→encrypt on unchanged content produces byte-identical ciphertext. Files not in the cache share a single new batch salt to minimise Argon2 overhead.

The cache is read-only during encryption; only the decrypt path writes to the cache.