cloakpipe_vector/lib.rs
1//! CloakPipe Vector — ADCPE distance-preserving vector encryption.
2//!
3//! Encrypts embedding vectors using a secret orthogonal transformation
4//! so that approximate nearest-neighbor relationships are preserved.
5//! This means encrypted vectors can still be used for similarity search
6//! in vector databases, but cannot be inverted back to the original
7//! embeddings (which could leak the source text).
8//!
9//! ## How it works
10//!
11//! 1. A secret orthogonal matrix Q is derived from a key using
12//! Gram-Schmidt orthogonalization of a seeded random matrix.
13//! 2. Each vector v is transformed: v' = Q * v (+ optional noise)
14//! 3. Cosine similarity is preserved: cos(Q*a, Q*b) = cos(a, b)
15//! 4. Optional Gaussian noise can be added for differential privacy,
16//! at the cost of slight distance distortion.
17
18pub mod adcpe;
19
20pub use adcpe::{AdcpeEncryptor, AdcpeConfig};