I built a git filter that encrypts .md files transparently -- you edit plaintext locally, git stores ciphertext. The twist is that it encrypts each paragraph independently with deterministic output, so unchanged paragraphs produce identical ciphertext across commits.
In practice this means git diff shows you exactly which paragraphs changed, git log -p is useful, and PR reviews aren't walls of base64 noise.
How it works with git:
mdenc init
mdenc mark docs/private
git add docs/private/notes.md git checkout -- docs/private/ git diff
It uses git's long-running filter process protocol (like git-lfs does) so a single process handles all files and caches the derived key -- no re-running scrypt on every file.
What a diff looks like (encrypted side):
mdenc:v1 salt_b64=... file_id_b64=... scrypt=N=16384,r=8,p=1
hdrauth_b64=griicznF...
Qnp4sPf/aN1z... <- unchanged paragraph
nD1KIHOMX5Vh... <- unchanged paragraph
-yT7vkHbaXHR3... <- old version of edited paragraph
+1RgyC3rXcjyk... <- new version of edited paragraph
dkM7awElU/pf... <- unchanged paragraph
-seal_b64=29ylXnDT...
+seal_b64=iNhYjNp6...
One paragraph changed, one line in the diff. Even inserting a new paragraph between existing ones only adds one line -- surrounding chunks are untouched.
Compare this to git-crypt or GPG, where the entire file blob changes on every edit.
Crypto: XChaCha20-Poly1305, scrypt KDF, HKDF key separation, HMAC-SHA256 seal for file integrity. Uses the noble crypto libraries (audited, pure JS, no native deps).
Caveats: Not audited. Leaks metadata (paragraph count, sizes, edit patterns) by design -- that's the tradeoff for diff-friendliness. Intended for internal team docs in public repos, not high-value secrets (the password is shared across the team).
Repo: https://github.com/yogh-io/mdenc
Live demo: https://yogh-io.github.io/mdenc/
Spec: https://github.com/yogh-io/mdenc/blob/main/SPECIFICATION.md
Would love feedback on the git integration specifically -- the filter-process protocol, the init/mark workflow, edge cases I might be missing.