forked from tuneinsight/lattigo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
keys.go
34 lines (27 loc) · 1.41 KB
/
keys.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package bfv
import "github.com/tuneinsight/lattigo/v4/rlwe"
// NewKeyGenerator creates a rlwe.KeyGenerator instance from the BFV parameters.
func NewKeyGenerator(params Parameters) rlwe.KeyGenerator {
return rlwe.NewKeyGenerator(params.Parameters)
}
// NewSecretKey returns an allocated BFV secret key with zero values.
func NewSecretKey(params Parameters) (sk *rlwe.SecretKey) {
return rlwe.NewSecretKey(params.Parameters)
}
// NewPublicKey returns an allocated BFV public with zero values.
func NewPublicKey(params Parameters) (pk *rlwe.PublicKey) {
return rlwe.NewPublicKey(params.Parameters)
}
// NewSwitchingKey returns an allocated BFV public switching key with zero values.
func NewSwitchingKey(params Parameters) *rlwe.SwitchingKey {
return rlwe.NewSwitchingKey(params.Parameters, params.QCount()-1, params.PCount()-1)
}
// NewRelinearizationKey returns an allocated BFV public relinearization key with zero value for each degree in [2 < maxRelinDegree].
func NewRelinearizationKey(params Parameters, maxRelinDegree int) *rlwe.RelinearizationKey {
return rlwe.NewRelinKey(params.Parameters, maxRelinDegree)
}
// NewRotationKeySet returns an allocated set of BFV public rotation keys with zero values for each galois element
// (i.e., for each supported rotation).
func NewRotationKeySet(params Parameters, galoisElements []uint64) *rlwe.RotationKeySet {
return rlwe.NewRotationKeySet(params.Parameters, galoisElements)
}