init: v1.0.0
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
package x
|
||||
|
||||
import (
|
||||
"crypto/rand"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"xdx.jelly/xgcl/grand"
|
||||
)
|
||||
|
||||
func TestPaillier(t *testing.T) {
|
||||
// pk, sk := GenerateKey(1024)
|
||||
|
||||
sk, pk, err := GenerateKey(2048)
|
||||
assert.Nil(t, err)
|
||||
|
||||
m, _ := rand.Int(grand.Reader, pk.N)
|
||||
c, _ := Encrypt(m, pk, grand.Reader)
|
||||
m1, _ := Decrypt(c, sk)
|
||||
|
||||
assert.Zero(t, m.Cmp(m1))
|
||||
}
|
||||
Reference in New Issue
Block a user