Documentation improvements, code cleaned up #2
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), nil}, 7, 6, b(3), []*big.Int{b(2), b(34)}}
|
key := &ThresholdKey{PublicKey{b(9), b(8)}, 7, 6, b(3), []*big.Int{b(2), b(34)}}
|
||||||
AssertBSONIsGood(key, new(ThresholdKey), t)
|
AssertBSONIsGood(key, new(ThresholdKey), t)
|
||||||
}
|
}
|
||||||
+1
-6
@@ -8,7 +8,6 @@ import (
|
|||||||
|
|
||||||
type PublicKey struct {
|
type PublicKey struct {
|
||||||
N, G *big.Int // usually G is set to N+1
|
N, G *big.Int // usually G is set to N+1
|
||||||
n2 *big.Int // the cache value of N^2
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *PublicKey) GetBSON() (interface{}, error) {
|
func (this *PublicKey) GetBSON() (interface{}, error) {
|
||||||
@@ -19,11 +18,7 @@ func (this *PublicKey) GetBSON() (interface{}, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *PublicKey) GetNSquare() *big.Int {
|
func (this *PublicKey) GetNSquare() *big.Int {
|
||||||
if this.n2 != nil {
|
return new(big.Int).Mul(this.N, this.N)
|
||||||
return this.n2
|
|
||||||
}
|
|
||||||
this.n2 = new(big.Int).Mul(this.N, this.N)
|
|
||||||
return this.n2
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Encode a plaintext in a cypher one. The plain text must be smaller that
|
// Encode a plaintext in a cypher one. The plain text must be smaller that
|
||||||
|
|||||||
Reference in new issue
Block a user