paillier

package
v0.0.0-...-872243e Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2019 License: GPL-3.0, LGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Author: xingchang@fusion.org

Index

Constants

This section is empty.

Variables

View Source
var ErrMessageTooLong = errors.New("[ERROR]: message is too long.")

Functions

func GenerateKeyPair

func GenerateKeyPair(length int) (*PublicKey, *PrivateKey)

Types

type PrivateKey

type PrivateKey struct {
	Length string
	PublicKey
	L *big.Int // (p-1)*(q-1)
	U *big.Int // L^-1 mod N
}

func (*PrivateKey) Decrypt

func (privateKey *PrivateKey) Decrypt(cipherBigInt *big.Int) (*big.Int, error)

func (*PrivateKey) ZkFactProve

func (privateKey *PrivateKey) ZkFactProve() *ZkFactProof

type PublicKey

type PublicKey struct {
	Length string
	N      *big.Int // n = p*q, where p and q are prime
	G      *big.Int // in practical, G = N + 1
	N2     *big.Int // N2 = N * N
}

func (*PublicKey) Encrypt

func (publicKey *PublicKey) Encrypt(mBigInt *big.Int) (*big.Int, *big.Int, error)

func (publicKey *PublicKey) Encrypt(mBigInt *big.Int) (*big.Int, error) {

func (*PublicKey) HomoAdd

func (publicKey *PublicKey) HomoAdd(c1, c2 *big.Int) *big.Int

func (*PublicKey) HomoMul

func (publicKey *PublicKey) HomoMul(cipher, k *big.Int) *big.Int

func (*PublicKey) ZkFactVerify

func (publicKey *PublicKey) ZkFactVerify(zkFactProof *ZkFactProof) bool

type ZkFactProof

type ZkFactProof struct {
	H1 *big.Int
	H2 *big.Int
	Y  *big.Int // r+(n-\phi(n))*e
	E  *big.Int
	N  *big.Int
}

Jump to

Keyboard shortcuts

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