Files
papers/lux-fhe-api/sections/04-encryption-and-decryption.tex
zeekay abf99d05fc papers: reorganize into per-paper dirs, add Antje Worring as co-author
Restructured from flat .tex/.pdf files into per-paper subdirectories.
Added Antje Worring as co-author on all papers.
Synced PDFs to pdfs/ for download site.
2026-04-18 21:50:07 -07:00

27 lines
837 B
TeX

\section{Encryption and Decryption}
\subsection{Boolean Encryption}
Single-bit encryption produces an LWE ciphertext:
\begin{lstlisting}[language=Go]
ct, err := enc.EncryptBit(true)
bit, err := dec.DecryptBit(ct)
// bit == true
\end{lstlisting}
\subsection{Integer Encryption}
Integers are decomposed into radix blocks, each block being a \texttt{ShortInt} (1--4 bits) encrypted in a single LWE ciphertext:
\begin{lstlisting}[language=Go]
intEnc := fhe.NewIntegerEncryptor(params, sk)
ct, err := intEnc.EncryptUint32(42)
val, err := intEnc.DecryptUint32(ct)
// val == 42
\end{lstlisting}
The \texttt{RadixCiphertext} type carries metadata about its FHE type (\texttt{FheUint8}, \texttt{FheUint16}, \texttt{FheUint32}, \texttt{FheUint64}, \texttt{FheUint128}, \texttt{FheUint256}) and enforces type matching at the API boundary.