Documentation ¶
Index ¶
- type Int
- func (z *Int) AddCiphertext(x, y *Int) *Int
- func (z *Int) AddPlaintext(x *Int, y *big.Int) *Int
- func (z *Int) Decrypt(privateKey *key.PrivateKey) *big.Int
- func (z *Int) DivPlaintext(x *Int, y *big.Int) *Int
- func (z *Int) MulPlaintext(x *Int, y *big.Int) *Int
- func (z *Int) SubCiphertext(x, y *Int) *Int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Int ¶
Int represents and encrypted integer using the Paillier cryptosystem. The public key used to encrypt the integer is also included. A notable feature of the Paillier cryptosystem is its homomorphic properties along with its non-deterministic encryption.
func (*Int) AddCiphertext ¶
AddCiphertext sets z to the encrypted sum x+y and returns z. If x.PublicKey != y.PublicKey, a pubic-keys-not-equal run-time panic occurs.
func (*Int) AddPlaintext ¶
AddPlaintext sets z to the encrypted sum x+y and returns z.
func (*Int) Decrypt ¶
func (z *Int) Decrypt(privateKey *key.PrivateKey) *big.Int
Decrypt returns the decrypted value of z using the given private key. If z.PublicKey != privateKey.PublicKey, a pubic-keys-not-equal run-time panic occurs.
func (*Int) DivPlaintext ¶
DivPlaintext sets z to the encrypted quotient x/y and returns z. If y == 0, a division-by-zero run-time panic occurs. DivPlaintext will return an invalid result in cases where y does not divide x.
func (*Int) MulPlaintext ¶
MulPlaintext sets z to the encrypted product x*y and returns z.
func (*Int) SubCiphertext ¶
SubCiphertext sets z to the encrypted difference x-y and returns z. If x.PublicKey != y.PublicKey, a pubic-keys-not-equal run-time panic occurs.