Documentation ¶
Overview ¶
Package lut implements look-up tables evaluation for R-LWE schemes.
Index ¶
- func InitLUT(g func(x float64) (y float64), scale float64, ringQ *ring.Ring, a, b float64) (F *ring.Poly)
- func MulBySmallMonomialMod2N(mask uint64, pol *ring.Poly, n int)
- type EvaluationKey
- type Evaluator
- func (eval *Evaluator) Evaluate(ct *rlwe.Ciphertext, lutPolyWihtSlotIndex map[int]*ring.Poly, ...) (res map[int]*rlwe.Ciphertext)
- func (eval *Evaluator) EvaluateAndRepack(ct *rlwe.Ciphertext, lutPolyWihtSlotIndex map[int]*ring.Poly, ...) (res *rlwe.Ciphertext)
- func (eval *Evaluator) ModSwitchRLWETo2NLvl(level int, polQ *ring.Poly, pol2N *ring.Poly)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitLUT ¶
func InitLUT(g func(x float64) (y float64), scale float64, ringQ *ring.Ring, a, b float64) (F *ring.Poly)
InitLUT takes a function g, and creates a LUT polynomial for the function in the interval [a, b]. Inputs to the LUT evaluation are assumed to have been normalized with the change of basis (2*x - a - b)/(b-a). Interval [a, b] should take into account the "drift" of the value x, caused by the change of modulus from Q to 2N.
Types ¶
type EvaluationKey ¶
type EvaluationKey struct { SkPos []*rgsw.Ciphertext SkNeg []*rgsw.Ciphertext }
EvaluationKey is a struct storing the encryption of the bits of the LWE key.
func GenEvaluationKey ¶
func GenEvaluationKey(paramsRLWE rlwe.Parameters, skRLWE *rlwe.SecretKey, paramsLWE rlwe.Parameters, skLWE *rlwe.SecretKey) (key EvaluationKey)
GenEvaluationKey generates the LUT evaluation key
type Evaluator ¶
type Evaluator struct { *rgsw.Evaluator Sk *rlwe.SecretKey // contains filtered or unexported fields }
Evaluator is a struct that stores the necessary data to handle LWE <-> RLWE conversion and LUT evaluation.
func NewEvaluator ¶
func NewEvaluator(paramsLUT, paramsLWE rlwe.Parameters, rtks *rlwe.RotationKeySet) (eval *Evaluator)
NewEvaluator creates a new Handler
func (*Evaluator) Evaluate ¶
func (eval *Evaluator) Evaluate(ct *rlwe.Ciphertext, lutPolyWihtSlotIndex map[int]*ring.Poly, key EvaluationKey) (res map[int]*rlwe.Ciphertext)
Evaluate extracts on the fly LWE samples and evaluates the provided LUT on the LWE. ct : a rlwe Ciphertext with coefficient encoded values at level 0 lutPolyWihtSlotIndex : a map with [slot_index] -> LUT lutKey : lut.Key Returns a map[slot_index] -> LUT(ct[slot_index])
func (*Evaluator) EvaluateAndRepack ¶
func (eval *Evaluator) EvaluateAndRepack(ct *rlwe.Ciphertext, lutPolyWihtSlotIndex map[int]*ring.Poly, repackIndex map[int]int, key EvaluationKey) (res *rlwe.Ciphertext)
EvaluateAndRepack extracts on the fly LWE samples, evaluates the provided LUT on the LWE and repacks everything into a single rlwe.Ciphertext. ct : a rlwe Ciphertext with coefficient encoded values at level 0 lutPolyWihtSlotIndex : a map with [slot_index] -> LUT repackIndex : a map with [slot_index_have] -> slot_index_want lutKey : LUTKey Returns a *rlwe.Ciphertext