Encrypted Modulo

L4 · Application Components
modulo · 2 specifications · 0 implementations · no benchmarks yet
WHAT IT ISCompute the elementwise modulo of two encrypted integer vectors under CKKS.
CKKS
SIGNATURE
kernel modulo<type T: Integer, N: u32>(
%xs: secret<tensor<N x T>>,
%ys: secret<tensor<N x T>>,
) -> %rs: secret<tensor<N x T>>
Sizes and element types are left open here. A specification fixes them; an implementation says over which of them it works.
DESCRIPTION

Definition

Modulo returns the remainder of one integer divided by another, taken element by element over encrypted operands:

ri=ximodyi,r_i = x_i \bmod y_i,

where each rir_i is the least non-negative residue — the unique integer with 0ri<yi0 \le r_i < |y_i| that is congruent to xix_i modulo yiy_i.

Mathematical Domain

Modulo is a non-arithmetic operation: it is nonlinear and piecewise, unlike the additions and multiplications a homomorphic scheme supports directly, which is what makes it a substantial component to build. The remainder is defined for integer operands with a nonzero divisor; a specification fixes the operand range over which it must hold — both the width of the encrypted integers and any restriction on the divisor. The kernel fixes neither the range nor the packing, and it does not mandate a scheme; a specification pins the domain and whether one modulo or many are computed at once.

Parameters Defined by Specifications

A specification narrows the general operation into a concrete problem by pinning:

  • the integer domain and width (for example i32);
  • the operand range over which correctness must hold, and the divisor restriction (nonzero);
  • scalar versus SIMD — one modulo, or one per slot;
  • the vector length NN in the SIMD case;
  • the input and output packing, and what is measured.

Applications

Modular reduction underlies hashing, checksums, and residue-number-system arithmetic; it is a step in many number-theoretic and cryptographic routines and in any confidential computation that must wrap encrypted counters or indices into a range. As a piecewise, nonlinear primitive it is also a stress test for the nonlinear-function machinery of an FHE stack.

MAINTAINER
FM
fairmathreviews specifications · resolves disputes
USED BY · 0 KERNELS
Kernels above this one. If this kernel is wrong, or slow, they are wrong or slow with it.Nothing depends on this kernel yet.
BUILDS ON · 0 KERNELS
Kernels this one is stated in terms of. Not a call graph — a statement of dependence between problems.Nothing. This kernel sits at the bottom of the graph.
RECENT ACTIVITYNothing yet.