Documentation ¶
Overview ¶
Package rgsw implements an RLWE-based RGSW encryption scheme. In RSGW, ciphertexts are tuples of two gadget ciphertexts where the first gadget ciphertext encrypts the message and the second gadget ciphertext encrypts the message times the secret. This package only implements a subset of the RGSW scheme that is necessary for bridging between RLWE and LWE-based schemes and for supporting look-up table evaluation.
Index ¶
- func AddLazy(op interface{}, ringQP ringqp.Ring, ctOut *Ciphertext)
- func MulByXPowAlphaMinusOneLazy(ctIn *Ciphertext, powXMinusOne ringqp.Poly, ringQP ringqp.Ring, ...)
- func MulByXPowAlphaMinusOneThenAddLazy(ctIn *Ciphertext, powXMinusOne ringqp.Poly, ringQP ringqp.Ring, ...)
- func Reduce(ctIn *Ciphertext, ringQP ringqp.Ring, ctOut *Ciphertext)
- type Ciphertext
- type Encryptor
- type Evaluator
- type Plaintext
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddLazy ¶
func AddLazy(op interface{}, ringQP ringqp.Ring, ctOut *Ciphertext)
AddLazy adds op to ctOut, without modular reduction.
func MulByXPowAlphaMinusOneLazy ¶
func MulByXPowAlphaMinusOneLazy(ctIn *Ciphertext, powXMinusOne ringqp.Poly, ringQP ringqp.Ring, ctOut *Ciphertext)
MulByXPowAlphaMinusOneLazy multiplies ctOut by (X^alpha - 1) and returns the result on ctOut.
func MulByXPowAlphaMinusOneThenAddLazy ¶
func MulByXPowAlphaMinusOneThenAddLazy(ctIn *Ciphertext, powXMinusOne ringqp.Poly, ringQP ringqp.Ring, ctOut *Ciphertext)
MulByXPowAlphaMinusOneThenAddLazy multiplies ctOut by (X^alpha - 1) and adds the result on ctOut.
func Reduce ¶
func Reduce(ctIn *Ciphertext, ringQP ringqp.Ring, ctOut *Ciphertext)
Reduce applies the modular reduction on ctIn and returns the result on ctOut.
Types ¶
type Ciphertext ¶
type Ciphertext struct {
Value [2]rlwe.GadgetCiphertext
}
Ciphertext is a generic type for RGSW ciphertext.
func NewCiphertext ¶
func NewCiphertext(params rlwe.Parameters, levelQ, levelP, decompRNS, decompBit int) (ct *Ciphertext)
NewCiphertext allocates a new RGSW ciphertext in the NTT domain.
func (*Ciphertext) LevelP ¶
func (ct *Ciphertext) LevelP() int
LevelP returns the level of the modulus P of the target.
func (*Ciphertext) LevelQ ¶
func (ct *Ciphertext) LevelQ() int
LevelQ returns the level of the modulus Q of the target.
type Encryptor ¶
Encryptor is a type for encrypting RGSW ciphertexts. It implements the rlwe.Encryptor interface overriding the `Encrypt` and `EncryptZero` methods to accept rgsw.Ciphertext types in addition to ciphertexts types in the rlwe package.
func NewEncryptor ¶
func NewEncryptor(params rlwe.Parameters, sk *rlwe.SecretKey) *Encryptor
NewEncryptor creates a new Encryptor type. Note that only secret-key encryption is supported at the moment.
func (*Encryptor) Encrypt ¶
Encrypt encrypts a plaintext pt into a ciphertext ct, which can be a rgsw.Ciphertext or any of the `rlwe` cipheretxt types.
func (*Encryptor) EncryptZero ¶
func (enc *Encryptor) EncryptZero(ct interface{})
EncryptZero generates an encryption of zero into a ciphertext ct, which can be a rgsw.Ciphertext or any of the `rlwe` cipheretxt types.
func (*Encryptor) ShallowCopy ¶
ShallowCopy creates a shallow copy of this Encryptor in which all the read-only data-structures are shared with the receiver and the temporary buffers are reallocated. The receiver and the returned Encryptors can be used concurrently.
type Evaluator ¶
Evaluator is a type for evaluating homomorphic operations involving RGSW ciphertexts. It currently supports the external product between a RLWE and a RGSW ciphertext (see Evaluator.ExternalProduct).
func NewEvaluator ¶
func NewEvaluator(params rlwe.Parameters, evk *rlwe.EvaluationKey) *Evaluator
NewEvaluator creates a new Evaluator type supporting RGSW operations in addition to rlwe.Evaluator operations.
func (*Evaluator) ExternalProduct ¶
func (eval *Evaluator) ExternalProduct(op0 *rlwe.Ciphertext, op1 *Ciphertext, op2 *rlwe.Ciphertext)
ExternalProduct computes RLWE x RGSW -> RLWE
RLWE : (-as + m + e, a) x RGSW : [(-as + P*w*m1 + e, a), (-bs + e, b + P*w*m1)] = RLWE : (<RLWE, RGSW[0]>, <RLWE, RGSW[1]>)
func (*Evaluator) ShallowCopy ¶
ShallowCopy creates a shallow copy of this Evaluator in which all the read-only data-structures are shared with the receiver and the temporary buffers are reallocated. The receiver and the returned Evaluators can be used concurrently.
func (*Evaluator) WithKey ¶
func (eval *Evaluator) WithKey(evaluationKey *rlwe.EvaluationKey) *Evaluator
WithKey creates a shallow copy of the receiver Evaluator for which the new EvaluationKey is evaluationKey and where the temporary buffers are shared. The receiver and the returned Evaluators cannot be used concurrently.
type Plaintext ¶
type Plaintext rlwe.GadgetPlaintext
Plaintext stores an RGSW plaintext value.
func NewPlaintext ¶
func NewPlaintext(params rlwe.Parameters, value interface{}, levelQ, levelP, logBase2, decompBIT int) (pt *Plaintext)
NewPlaintext creates a new RGSW plaintext from value, which can be either uint64, int64 or *ring.Poly. Plaintext is returned in the NTT and Mongtomery domain.