xtrace_sdk.x_vec.crypto.hamming_client_base =========================================== .. py:module:: xtrace_sdk.x_vec.crypto.hamming_client_base Classes ------- .. autoapisummary:: xtrace_sdk.x_vec.crypto.hamming_client_base.HammingClientBase Module Contents --------------- .. py:class:: HammingClientBase Bases: :py:obj:`abc.ABC` Abstract base class for homomorphic encryption clients used in encrypted Hamming distance search. Concrete implementations (``PaillierClient``, ``PaillierLookupClient``) encrypt binary embedding vectors on the client side, send the ciphertexts to XTrace, and later decrypt the encoded Hamming distances returned by the server — without the server ever seeing plaintext vectors or distances. .. py:method:: encrypt_vec_one(embd) :abstractmethod: Encrypt a single binary embedding vector. :param embd: Binary vector of length ``embed_len`` with values in {0, 1}. :type embd: list[int] :return: Encrypted representation of the vector. :rtype: list[int] .. py:method:: encrypt_vec_batch(embds) :abstractmethod: Encrypt a batch of binary embedding vectors. :param embds: List of binary vectors, each of length ``embed_len`` with values in {0, 1}. :type embds: list[list[int]] :return: List of encrypted representations, one per input vector. :rtype: list[list[int]] .. py:method:: decode_hamming_client_one(cipher) :abstractmethod: Decrypt a single encrypted Hamming distance returned by the XTrace server. :param cipher: Encrypted Hamming encoding as returned by the server. :type cipher: list[int] :return: Plain-text Hamming distance. :rtype: int .. py:method:: decode_hamming_client_batch(ciphers) :abstractmethod: Decrypt a batch of encrypted Hamming distances returned by the XTrace server. :param ciphers: List of encrypted Hamming encodings as returned by the server. :type ciphers: list[list[int]] :return: List of plain-text Hamming distances, one per input cipher. :rtype: list[int]