paillier

package
v0.0.0-...-72d4bdf Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 18, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Encrypt

func Encrypt(m *big.Int, pub *PublicKey) *big.Int

func GenerateRandom

func GenerateRandom(n *big.Int) *big.Int

func L

func L(u, n *big.Int) *big.Int

L(u) = (u - 1) / n

Types

type PrivateKey

type PrivateKey struct {
	PublicKey          // public part.
	Lambda    *big.Int // lcm(p - 1, q - 1)
	Mu        *big.Int // L(g ^ lambda mod n ^ 2) ^ -1 mod n
}

秘密鍵 (p, q)

func GenerateKey

func GenerateKey(random io.Reader, bits int) (*PrivateKey, error)

GenerateKey generates an Paillier keypair of the given bit size using the random source random (for example, crypto/rand.Reader).

func (*PrivateKey) Decrypt

func (priv *PrivateKey) Decrypt(c *big.Int) *big.Int

func (*PrivateKey) Equal

func (priv *PrivateKey) Equal(x crypto.PrivateKey) bool

func (*PrivateKey) Public

func (priv *PrivateKey) Public() crypto.PublicKey

type PublicKey

type PublicKey struct {
	G *big.Int // random number
	N *big.Int // p * q
}

公開鍵 (g, n)

func (*PublicKey) Equal

func (pub *PublicKey) Equal(x crypto.PublicKey) bool

func (*PublicKey) Size

func (pub *PublicKey) Size() int

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL