G parameter moved from PublicKey to ThresholdKey
We don't need G for our PublicKey since it's now always equal N+1. It's required by the `ThresholdKey` to compile, so I moved it there. I will investigate if for a threshold Paillier scheme G is really needed in the pkey.
This commit is contained in:
3 files changed
+4
-5
No files matched your search
+1
-1
@@ -118,6 +118,6 @@ func TestPartialDecryptionZKPBSONification(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestThresholdKeyBSON(t *testing.T) {
|
func TestThresholdKeyBSON(t *testing.T) {
|
||||||
key := &ThresholdKey{PublicKey{b(9), b(8)}, 7, 6, b(3), []*big.Int{b(2), b(34)}}
|
key := &ThresholdKey{PublicKey{b(9)}, 7, 6, b(3), []*big.Int{b(2), b(34)}, b(8)}
|
||||||
AssertBSONIsGood(key, new(ThresholdKey), t)
|
AssertBSONIsGood(key, new(ThresholdKey), t)
|
||||||
}
|
}
|
||||||
+2
-4
@@ -7,12 +7,11 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type PublicKey struct {
|
type PublicKey struct {
|
||||||
N, G *big.Int // usually G is set to N+1
|
N *big.Int // usually G is set to N+1
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *PublicKey) GetBSON() (interface{}, error) {
|
func (this *PublicKey) GetBSON() (interface{}, error) {
|
||||||
m := make(map[string]string)
|
m := make(map[string]string)
|
||||||
m["g"] = fmt.Sprintf("%x", this.G)
|
|
||||||
m["n"] = fmt.Sprintf("%x", this.N)
|
m["n"] = fmt.Sprintf("%x", this.N)
|
||||||
return m, nil
|
return m, nil
|
||||||
}
|
}
|
||||||
@@ -57,8 +56,7 @@ type PrivateKey struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *PrivateKey) String() string {
|
func (this *PrivateKey) String() string {
|
||||||
ret := fmt.Sprintf("g : %x", this.G)
|
ret := fmt.Sprintf("n : %x", this.N)
|
||||||
ret += fmt.Sprintf("n : %x", this.N)
|
|
||||||
ret += fmt.Sprintf("lambda: %x", this.Lambda)
|
ret += fmt.Sprintf("lambda: %x", this.Lambda)
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ type ThresholdKey struct {
|
|||||||
Threshold int
|
Threshold int
|
||||||
V *big.Int
|
V *big.Int
|
||||||
Vi []*big.Int
|
Vi []*big.Int
|
||||||
|
G *big.Int
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns the value of (4*delta**2)** -1 mod n
|
// returns the value of (4*delta**2)** -1 mod n
|
||||||
|
|||||||
Reference in new issue
Block a user