hebin

package
v5.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 16, 2023 License: Apache-2.0 Imports: 7 Imported by: 2

README

References

  1. Efficient FHEW Bootstrapping with Small Evaluation Keys, and Applications to Threshold Homomorphic Encryption (https://eprint.iacr.org/2022/198)

Documentation

Overview

Package hebin implements blind rotations evaluation for RLWE schemes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitTestPolynomial

func InitTestPolynomial(g func(x float64) (y float64), scale rlwe.Scale, ringQ *ring.Ring, a, b float64) (F ring.Poly)

InitTestPolynomial takes a function g, and creates a test polynomial polynomial for the function in the interval [a, b]. Inputs to the blind rotation 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 BlindRotationEvaluationKeySet

type BlindRotationEvaluationKeySet interface {

	// GetBlindRotationKey should return RGSW(X^{s[i]})
	GetBlindRotationKey(i int) (brk *rgsw.Ciphertext, err error)

	// GetEvaluationKeySet should return an rlwe.EvaluationKeySet
	// providing access to all the required automorphism keys.
	GetEvaluationKeySet() (evk rlwe.EvaluationKeySet, err error)
}

BlindRotationEvaluationKeySet is a interface implementing methods to load the blind rotation keys (RGSW) and automorphism keys (via the rlwe.EvaluationKeySet interface). Implementation of this interface must be safe for concurrent use.

type Evaluator

type Evaluator struct {
	*rgsw.Evaluator
	// contains filtered or unexported fields
}

Evaluator is a struct that stores the necessary data to handle LWE <-> RLWE conversion and blind rotations.

func NewEvaluator

func NewEvaluator(paramsBR, paramsLWE rlwe.ParameterProvider) (eval *Evaluator)

NewEvaluator instantiates a new Evaluator.

func (*Evaluator) BlindRotateCore

func (eval *Evaluator) BlindRotateCore(a []uint64, acc *rlwe.Ciphertext, evk BlindRotationEvaluationKeySet) (err error)

BlindRotateCore implements Algorithm 3 of https://eprint.iacr.org/2022/198

func (*Evaluator) Evaluate

func (eval *Evaluator) Evaluate(ct *rlwe.Ciphertext, testPolyWithSlotIndex map[int]*ring.Poly, key BlindRotationEvaluationKeySet) (res map[int]*rlwe.Ciphertext, err error)

Evaluate extracts on the fly LWE samples and evaluates the provided blind rotation on the LWE. testPolyWithSlotIndex : a map with [slot_index] -> blind rotation Returns a map[slot_index] -> BlindRotate(ct[slot_index])

func (*Evaluator) EvaluateAndRepack

func (eval *Evaluator) EvaluateAndRepack(ct *rlwe.Ciphertext, testPolyWithSlotIndex map[int]*ring.Poly, repackIndex map[int]int, key BlindRotationEvaluationKeySet, repackKey rlwe.EvaluationKeySet) (res *rlwe.Ciphertext, err error)

EvaluateAndRepack extracts on the fly LWE samples, evaluates the provided blind rotations on the LWE and repacks everything into a single rlwe.Ciphertext. testPolyWithSlotIndex : a map with [slot_index] -> blind rotation repackIndex : a map with [slot_index_have] -> slot_index_want

type MemBlindRotationEvaluationKeySet

type MemBlindRotationEvaluationKeySet struct {
	BlindRotationKeys []*rgsw.Ciphertext
	AutomorphismKeys  []*rlwe.GaloisKey
}

MemBlindRotationEvaluationKeySet is a basic in-memory implementation of the BlindRotationEvaluationKeySet interface.

func GenEvaluationKeyNew

func GenEvaluationKeyNew(paramsRLWE rlwe.ParameterProvider, skRLWE *rlwe.SecretKey, paramsLWE rlwe.ParameterProvider, skLWE *rlwe.SecretKey, evkParams ...rlwe.EvaluationKeyParameters) (key MemBlindRotationEvaluationKeySet)

GenEvaluationKeyNew generates a new Blind Rotation evaluation key

func (MemBlindRotationEvaluationKeySet) GetBlindRotationKey

func (evk MemBlindRotationEvaluationKeySet) GetBlindRotationKey(i int) (*rgsw.Ciphertext, error)

func (MemBlindRotationEvaluationKeySet) GetEvaluationKeySet

func (evk MemBlindRotationEvaluationKeySet) GetEvaluationKeySet() (rlwe.EvaluationKeySet, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL