m15 := big.NewInt(15)
m20 := big.NewInt(20)
privKey, _ := OU.GenerateKey(rand.Reader, 3072)
c15, _ := OU.Encrypt(&privKey.PublicKey, m15.Bytes())
c20, _ := OU.Encrypt(&privKey.PublicKey, m20.Bytes())
c35 := OU.AddCipher(c15, c20, &privKey.PublicKey)
m2 := big.NewInt(2)
c30 := OU.MulCipher(c15, m2, &privKey.PublicKey)
d35, _ := OU.Decrypt(privKey, c35)
d30, _ := OU.Decrypt(privKey, c30)
fmt.Println("OU Decryption 20+15 Result : ", d35.String())
fmt.Println("OU Decryption 15*2 Result : ", d30.String())
Paillier使用代码Paillier
paillier-3072 1000times encrypto all cost=[39.279695391s]
paillier-3072 1000times decrypto all cost=[10.490600826s]
OU encrypto 1000 times cost=[9.083451724s]
OU decrypto 1000 times cost=[1.400994954s]