mpc

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GlobalPRG int = -1
)

Variables

This section is empty.

Functions

func CSigmoidApprox

func CSigmoidApprox(sourcePid int, net *Network, cryptoParams *crypto.CryptoParams, ctIn crypto.CipherVector,
	intv crypto.IntervalApprox, mutex *sync.Mutex) crypto.CipherVector

func CloseChannel

func CloseChannel(conn net.Conn)

CloseChannel closes connection

func Connect

func Connect(ip, port string) net.Conn

Connect to "server", given the ip address and port

func InitializeParallelPRG

func InitializeParallelPRG(sharedKeysPath string, network []*Network, pid int, nparties int)

func MarshalCV

func MarshalCV(cv crypto.CipherVector) ([]byte, []byte)

MarshalCV returns bytes for ct sizes and bytes for each chiphertext: 8 bytes used //TODO: check if 4 bytes are enough

func MarshalPolyMat

func MarshalPolyMat(polys [][]ring.Poly) ([]byte, []byte)

func MarshalRData

func MarshalRData(val interface{}) []byte

func OpenChannel

func OpenChannel(ip, port string) (net.Conn, net.Listener)

OpenChannel opens channel at specificed ip address and port and returns channel (server side, connection for client to listen to)

func ReadFull

func ReadFull(conn *net.Conn, buf []byte)

func SaveBytesToFile

func SaveBytesToFile(b []byte, filename string)

func SaveMatrixToFileWithPrint

func SaveMatrixToFileWithPrint(cps *crypto.CryptoParams, mpcObj *MPC, cm crypto.CipherMatrix, nElemCol int, sourcePid int, filename string, print bool)

func SaveMatrixToFileWithPrintIndex

func SaveMatrixToFileWithPrintIndex(cps *crypto.CryptoParams, mpcObj *MPC, cm crypto.CipherMatrix, nElemCol int, sourcePid int, filename string, print bool, firstIndex, lastIndex int)

SaveMatrixToFileWithPrint saves a matrix to a file and prints the first nElemCol elements of each row

func Sigmoid

func Sigmoid(x complex128) complex128

func SigmoidApprox

func SigmoidApprox(sourcePid int, net *Network, cryptoParams *crypto.CryptoParams, ctIn *ckks.Ciphertext,
	intv crypto.IntervalApprox, mutex *sync.Mutex) *ckks.Ciphertext

func UnmarshalCV

func UnmarshalCV(cryptoParams *crypto.CryptoParams, ncts int, sbytes, ctbytes []byte) crypto.CipherVector

UnmarshalCipherVector updates cv to have the correct ciphertexts (cv must have the corrext size)

func UnmarshalPolyMat

func UnmarshalPolyMat(sizes, bytes []byte) [][]ring.Poly

func WriteFull

func WriteFull(conn *net.Conn, buf []byte)

Types

type MPC

type MPC struct {
	Network *Network
	// contains filtered or unexported fields
}

func InitParallelMPCEnv

func InitParallelMPCEnv(netObjs []*Network, rtype mpc_core.RElem, dataBits, fracBits int) []*MPC

func (*MPC) AssertSync

func (mpcObj *MPC) AssertSync()

func (*MPC) BeaverMult

func (mpcObj *MPC) BeaverMult(ar, am, br, bm mpc_core.RElem) mpc_core.RElem

func (*MPC) BeaverMultElemMat

func (mpcObj *MPC) BeaverMultElemMat(ar, am, br, bm mpc_core.RMat) mpc_core.RMat

func (*MPC) BeaverMultElemVec

func (mpcObj *MPC) BeaverMultElemVec(ar, am, br, bm mpc_core.RVec) mpc_core.RVec

func (*MPC) BeaverMultMat

func (mpcObj *MPC) BeaverMultMat(ar, am, br, bm mpc_core.RMat) mpc_core.RMat

func (*MPC) BeaverPartition

func (mpcObj *MPC) BeaverPartition(a mpc_core.RElem) (mpc_core.RElem, mpc_core.RElem)

func (*MPC) BeaverPartitionMat

func (mpcObj *MPC) BeaverPartitionMat(a mpc_core.RMat) (mpc_core.RMat, mpc_core.RMat)

Returns ar, am

func (*MPC) BeaverPartitionVec

func (mpcObj *MPC) BeaverPartitionVec(a mpc_core.RVec) (mpc_core.RVec, mpc_core.RVec)

func (*MPC) BeaverReconstruct

func (mpcObj *MPC) BeaverReconstruct(a mpc_core.RElem) mpc_core.RElem

func (*MPC) BeaverReconstructMat

func (mpcObj *MPC) BeaverReconstructMat(a mpc_core.RMat) mpc_core.RMat

func (*MPC) BeaverReconstructVec

func (mpcObj *MPC) BeaverReconstructVec(a mpc_core.RVec) mpc_core.RVec

func (*MPC) BinaryAddPublic

func (mpcObj *MPC) BinaryAddPublic(aPub mpc_core.RMat, b mpc_core.RMat, numBits int) mpc_core.RMat

func (*MPC) BinaryPrefixOr

func (mpcObj *MPC) BinaryPrefixOr(a mpc_core.RMat, numBits int) mpc_core.RMat

func (*MPC) CMatToSS

func (mpcObj *MPC) CMatToSS(cryptoParams *crypto.CryptoParams, rtype mpc_core.RElem, cm crypto.CipherMatrix, sourcePid, numCtxRow, numCtxCol, nElemRow int) (rm mpc_core.RMat)

func (*MPC) CVecToSS

func (mpcObj *MPC) CVecToSS(cryptoParams *crypto.CryptoParams, rtype mpc_core.RElem, cv crypto.CipherVector, sourcePid, numCtx, nElem int) (rm mpc_core.RVec)

func (*MPC) CarryOutAux

func (mpcObj *MPC) CarryOutAux(dProp mpc_core.RMat, dGen mpc_core.RMat, numBits int) mpc_core.RVec

func (*MPC) CarryOutPublic

func (mpcObj *MPC) CarryOutPublic(aPub mpc_core.RMat, b mpc_core.RMat, numBits int) mpc_core.RVec

Each column of aPub and b encodes a bitwise-shared number (mpc_core.BElem) with length numBits Outputs the final carry bit of the binary addition of each pair of columns (as LSB of mpc_core.BElem) Reference: https://faui1-files.cs.fau.de/filepool/publications/octavian_securescm/SecureSCM-D.9.2.pdf

func (*MPC) CarryOverPublic

func (mpcObj *MPC) CarryOverPublic(aPub mpc_core.RMat, b mpc_core.RMat, numBits int) mpc_core.RMat

Each column of aPub and b encodes a bitwise-shared number (mpc_core.BElem) with length numBits Outputs all carry bits of the binary addition of each pair of columns (in each output column) Reference: https://faui1-files.cs.fau.de/filepool/publications/octavian_securescm/SecureSCM-D.9.2.pdf

func (*MPC) CiphertextToSS

func (mpcObj *MPC) CiphertextToSS(cryptoParams *crypto.CryptoParams, rtype mpc_core.RElem, ct *ckks.Ciphertext, sourcePid, N int) (rv mpc_core.RVec)

func (*MPC) Divide

func (mpcObj *MPC) Divide(a, b mpc_core.RVec, binaryVersion bool) mpc_core.RVec

func (*MPC) EigenDecomp

func (mpcObj *MPC) EigenDecomp(A mpc_core.RMat) (V mpc_core.RMat, L mpc_core.RVec)

func (*MPC) EvaluatePoly

func (mpcObj *MPC) EvaluatePoly(a mpc_core.RVec, coeff mpc_core.RMat) mpc_core.RMat

func (*MPC) FanInOr

func (mpcObj *MPC) FanInOr(a mpc_core.RMat) mpc_core.RVec

func (*MPC) FlipBit

func (mpcObj *MPC) FlipBit(a mpc_core.RVec) mpc_core.RVec

func (*MPC) GetBooleanShareFlag

func (mpcObj *MPC) GetBooleanShareFlag() bool

func (*MPC) GetCRPGen

func (mpcObj *MPC) GetCRPGen() *ring.UniformSampler

func (*MPC) GetDataBits

func (mpcObj *MPC) GetDataBits() int

func (*MPC) GetFracBits

func (mpcObj *MPC) GetFracBits() int

func (*MPC) GetHubPid

func (mpcObj *MPC) GetHubPid() int

func (*MPC) GetMHEContext

func (mpcObj *MPC) GetMHEContext() *dckks.Context

func (*MPC) GetNParty

func (mpcObj *MPC) GetNParty() int

func (*MPC) GetPascalMatrix

func (mpcObj *MPC) GetPascalMatrix(rtype mpc_core.RElem, pow int) mpc_core.RMat

GetPascalMat retrieves the pascal matrix associated with the given power

func (*MPC) GetPid

func (mpcObj *MPC) GetPid() int

func (*MPC) GetRType

func (mpcObj *MPC) GetRType() mpc_core.RElem

func (*MPC) Householder

func (mpcObj *MPC) Householder(x mpc_core.RVec) mpc_core.RVec

Linear algebra routines for eigen-decomposition

func (*MPC) InitLagrangeCache

func (mpcObj *MPC) InitLagrangeCache()

func (*MPC) IsPositive

func (mpcObj *MPC) IsPositive(a mpc_core.RVec, binaryVersion bool) mpc_core.RVec

func (*MPC) IsPositive2N

func (mpcObj *MPC) IsPositive2N(x mpc_core.RVec) mpc_core.RVec

Assumes x is LElem256 or LElem128 for now

func (*MPC) LessThan

func (mpcObj *MPC) LessThan(a, b mpc_core.RVec, binaryVersion bool) mpc_core.RVec

func (*MPC) LessThanBits

func (mpcObj *MPC) LessThanBits(a, b mpc_core.RMat) mpc_core.RVec

func (*MPC) LessThanBitsAux

func (mpcObj *MPC) LessThanBitsAux(a, b mpc_core.RMat, isPublic bool) mpc_core.RVec

b is public if isPublic = true,

func (*MPC) LessThanBitsPublic

func (mpcObj *MPC) LessThanBitsPublic(a, bpub mpc_core.RMat) mpc_core.RVec

b is public

func (*MPC) LessThanPublic

func (mpcObj *MPC) LessThanPublic(a mpc_core.RVec, bpub mpc_core.RElem, binaryVersion bool) mpc_core.RVec

func (*MPC) MatrixInverseSVD

func (mpcObj *MPC) MatrixInverseSVD(A mpc_core.RMat) (AInv mpc_core.RMat)

If the column norms of A are too large or small there can be precision issues Closer they are to unit norm the better

func (*MPC) MatrixInverseSqrtSVD

func (mpcObj *MPC) MatrixInverseSqrtSVD(A mpc_core.RMat) (AInvSqrt mpc_core.RMat)

Takes input A and returns B such that B^T * B = A Requirement: A is symmetric

func (*MPC) MatrixInverseSymPos

func (mpcObj *MPC) MatrixInverseSymPos(ASymPosDef mpc_core.RMat) (AInv, AInvSqrt mpc_core.RMat)

Assumes A is a symmetric, positive definite matrix (positive eigenvalues) Outputs both AInv and AInvSqrt, where AInv = AInvSqrt' * AInvSqrt

func (*MPC) NormalizerEvenExp

func (mpcObj *MPC) NormalizerEvenExp(a mpc_core.RVec, k int) (mpc_core.RVec, mpc_core.RVec)

Returns power-of-two multipliers b and sqrt(b) (for each a) where the bit length of a * b becomes k or k-1. Requires input a to be strictly positive and k to be even For statistical security, also requires ring modulus to be at least 30 bits longer than the maximum data bit length k

func (*MPC) NormalizerEvenExp2N

func (mpcObj *MPC) NormalizerEvenExp2N(x mpc_core.RVec, k int) (mpc_core.RVec, mpc_core.RVec)

func (*MPC) NotLessThan

func (mpcObj *MPC) NotLessThan(a, b mpc_core.RVec, binaryVersion bool) mpc_core.RVec

func (*MPC) NotLessThanPublic

func (mpcObj *MPC) NotLessThanPublic(a mpc_core.RVec, bpub mpc_core.RElem, binaryVersion bool) mpc_core.RVec

func (*MPC) Powers

func (mpcObj *MPC) Powers(a mpc_core.RVec, pow int) mpc_core.RMat

The i-th column of output contains 0,1,...,pow powers of a[i]

func (*MPC) PrefixOr

func (mpcObj *MPC) PrefixOr(a mpc_core.RMat) mpc_core.RMat

Return prefix-OR of each row in a containing secret shares of bits

func (*MPC) QRFactSquare

func (mpcObj *MPC) QRFactSquare(A mpc_core.RMat) (Q, R mpc_core.RMat)

func (*MPC) RevealSym

func (mpcObj *MPC) RevealSym(a mpc_core.RElem) mpc_core.RElem

func (*MPC) RevealSymMat

func (mpcObj *MPC) RevealSymMat(a mpc_core.RMat) mpc_core.RMat

func (*MPC) RevealSymVec

func (mpcObj *MPC) RevealSymVec(a mpc_core.RVec) mpc_core.RVec

func (*MPC) SSMultElemMat

func (mpcObj *MPC) SSMultElemMat(a, b mpc_core.RMat) mpc_core.RMat

func (*MPC) SSMultElemVec

func (mpcObj *MPC) SSMultElemVec(a, b mpc_core.RVec) mpc_core.RVec

func (*MPC) SSMultElemVecScalar

func (mpcObj *MPC) SSMultElemVecScalar(a mpc_core.RVec, b mpc_core.RElem) mpc_core.RVec

func (*MPC) SSMultMat

func (mpcObj *MPC) SSMultMat(a, b mpc_core.RMat) mpc_core.RMat

func (*MPC) SSSquareElemVec

func (mpcObj *MPC) SSSquareElemVec(a mpc_core.RVec) mpc_core.RVec

func (*MPC) SSToCMat

func (mpcObj *MPC) SSToCMat(cryptoParams *crypto.CryptoParams, rm mpc_core.RMat) (cm crypto.CipherMatrix)

Row-major

func (*MPC) SSToCVec

func (mpcObj *MPC) SSToCVec(cryptoParams *crypto.CryptoParams, rv mpc_core.RVec) (cv crypto.CipherVector)

func (*MPC) SStoCiphertext

func (mpcObj *MPC) SStoCiphertext(cryptoParams *crypto.CryptoParams, rv mpc_core.RVec) *ckks.Ciphertext

func (*MPC) SetBooleanShareFlag

func (mpcObj *MPC) SetBooleanShareFlag(flag bool)

func (*MPC) SetDivSqrtMaxLen

func (mpcObj *MPC) SetDivSqrtMaxLen(num int)

func (*MPC) SetFracBits

func (mpcObj *MPC) SetFracBits(f int)

func (*MPC) SetHubPid

func (mpcObj *MPC) SetHubPid(p int)

func (*MPC) SetNParty

func (mpcObj *MPC) SetNParty(np int)

func (*MPC) SetPid

func (mpcObj *MPC) SetPid(p int)

func (*MPC) ShareRandomBits

func (mpcObj *MPC) ShareRandomBits(rtype, rtypeBit mpc_core.RElem, n, nbitsOut, nbitsSample int, bitSample bool) (mpc_core.RVec, mpc_core.RMat)

Secret share random numbers in rtype (output as RVec) and bit-wise secret shares of the same numbers in rtypeBit (output as RMat) Party 0 obtains underlying values If bitSample is true, uniformly samples from [0, 2^nbitsSample); otherwise samples from [0, rtype.Modulus())

func (*MPC) SortRowsDescend

func (mpcObj *MPC) SortRowsDescend(A mpc_core.RMat, w mpc_core.RVec) (ASorted mpc_core.RMat, wSorted mpc_core.RVec)

func (*MPC) SqrtAndSqrtInverse

func (mpcObj *MPC) SqrtAndSqrtInverse(a mpc_core.RVec, binaryVersion bool) (b, bInv mpc_core.RVec)

Assumes K - F is even

func (*MPC) SuffixCarryAux

func (mpcObj *MPC) SuffixCarryAux(dProp mpc_core.RMat, dGen mpc_core.RMat, numBits int) mpc_core.RMat

func (*MPC) Swap

func (mpcObj *MPC) Swap(v1 mpc_core.RVec, v2 mpc_core.RVec, isFlip mpc_core.RElem) (o1 mpc_core.RVec, o2 mpc_core.RVec)

func (*MPC) TableLookup

func (mpcObj *MPC) TableLookup(a mpc_core.RVec, tableId int) mpc_core.RMat

func (*MPC) TableLookupWithShareConversion

func (mpcObj *MPC) TableLookupWithShareConversion(rtypeOut mpc_core.RElem, a mpc_core.RVec, tableId int) mpc_core.RMat

func (*MPC) Tridiag

func (mpcObj *MPC) Tridiag(A mpc_core.RMat) (T, Q mpc_core.RMat)

func (*MPC) Trunc

func (mpcObj *MPC) Trunc(a mpc_core.RElem, k, m int) mpc_core.RElem

func (*MPC) TruncMat

func (mpcObj *MPC) TruncMat(a mpc_core.RMat, k, m int) mpc_core.RMat

func (*MPC) TruncVec

func (mpcObj *MPC) TruncVec(a mpc_core.RVec, k, m int) mpc_core.RVec

type MpcRoutine

type MpcRoutine func(*MPC, mpc_core.RMat, mpc_core.RElem) mpc_core.RVec

type Network

type Network struct {
	NumParties int

	Rand *Random

	SentBytes     map[int]uint64
	ReceivedBytes map[int]uint64
	// contains filtered or unexported fields
}

func InitCommunication

func InitCommunication(bindingIP string, servers map[string]Server, pid, nparties, numThreads int, sharedKeysPath string) []*Network

InitNetworkParalelization creates communication channels for parallelization: channel btw each pair of machines for every thread

func (*Network) AggregateCMat

func (netObj *Network) AggregateCMat(cryptoParams *crypto.CryptoParams, mat crypto.CipherMatrix) (out crypto.CipherMatrix)

func (*Network) AggregateCText

func (netObj *Network) AggregateCText(cryptoParams *crypto.CryptoParams, val *ckks.Ciphertext) (out *ckks.Ciphertext)

func (*Network) AggregateCVec

func (netObj *Network) AggregateCVec(cryptoParams *crypto.CryptoParams, vec crypto.CipherVector) crypto.CipherVector

func (*Network) AggregateDecryptShares

func (netObj *Network) AggregateDecryptShares(poly *dckks.PCKSShare, outLevel int) (out *dckks.PCKSShare)

level := uint64(len(share1[0].Coeffs)) - 1 pcks.dckksContext.RingQ.AddLvl(level, share1[0], share2[0], shareOut[0]) pcks.dckksContext.RingQ.AddLvl(level, share1[1], share2[1], shareOut[1])

func (*Network) AggregateDecryptSharesMat

func (netObj *Network) AggregateDecryptSharesMat(poly [][]dckks.PCKSShare, outLevel int) (out [][]dckks.PCKSShare)

func (*Network) AggregateIntVec

func (netObj *Network) AggregateIntVec(vec []uint64) (out []uint64)

func (*Network) AggregatePubKeyShares

func (netObj *Network) AggregatePubKeyShares(poly *drlwe.CKGShare) (out *drlwe.CKGShare)

func (*Network) AggregateRefreshShare

func (netObj *Network) AggregateRefreshShare(share *ring.Poly, outLevel int) (shareOut *ring.Poly)

func (*Network) AggregateRefreshShareMat

func (netObj *Network) AggregateRefreshShareMat(share [][]ring.Poly, outLevel int) (shareOut [][]ring.Poly)

func (*Network) AggregateRefreshShareVec

func (netObj *Network) AggregateRefreshShareVec(share []*ring.Poly, outLevel int) (shareOut []*ring.Poly)

func (*Network) AggregateRelinKeyShare

func (netObj *Network) AggregateRelinKeyShare(share *drlwe.RKGShare, secondSlot bool) (shareOut *drlwe.RKGShare)

func (*Network) AggregateRotKeyShare

func (netObj *Network) AggregateRotKeyShare(share *drlwe.RTGShare) (shareOut *drlwe.RTGShare)

func (*Network) AggregateSharesCT

func (netObj *Network) AggregateSharesCT(cryptoParams *crypto.CryptoParams, ct *ckks.Ciphertext) *ckks.Ciphertext

func (*Network) BootstrapMatAll

func (netObj *Network) BootstrapMatAll(cps *crypto.CryptoParams, cm crypto.CipherMatrix) crypto.CipherMatrix

BootstrapMatAll: collective bootstrap for all parties (except 0)

func (*Network) BootstrapVecAll

func (netObj *Network) BootstrapVecAll(cps *crypto.CryptoParams, cv crypto.CipherVector) crypto.CipherVector

func (*Network) BroadcastCMat

func (netObj *Network) BroadcastCMat(cps *crypto.CryptoParams, cm crypto.CipherMatrix, sourcePid int, numCtxRow, numCtxCol int) crypto.CipherMatrix

func (*Network) BroadcastCVec

func (netObj *Network) BroadcastCVec(cps *crypto.CryptoParams, cv crypto.CipherVector, sourcePid int, numCtx int) crypto.CipherVector

func (*Network) BroadcastCiphertext

func (netObj *Network) BroadcastCiphertext(cps *crypto.CryptoParams, ct *ckks.Ciphertext, sourcePid int) *ckks.Ciphertext

func (*Network) CloseAll

func (netObj *Network) CloseAll()

func (*Network) CollectiveBootstrap

func (netObj *Network) CollectiveBootstrap(cps *crypto.CryptoParams, ct *ckks.Ciphertext, sourcePid int)

func (*Network) CollectiveBootstrapMat

func (netObj *Network) CollectiveBootstrapMat(cps *crypto.CryptoParams, cm crypto.CipherMatrix, sourcePid int) crypto.CipherMatrix

func (*Network) CollectiveBootstrapVec

func (netObj *Network) CollectiveBootstrapVec(cps *crypto.CryptoParams, cv crypto.CipherVector, sourcePid int) crypto.CipherVector

func (*Network) CollectiveDecrypt

func (netObj *Network) CollectiveDecrypt(cps *crypto.CryptoParams, ct *ckks.Ciphertext, sourcePid int) (pt *ckks.Plaintext)

func (*Network) CollectiveDecryptMat

func (netObj *Network) CollectiveDecryptMat(cps *crypto.CryptoParams, cm crypto.CipherMatrix, sourcePid int) (pm crypto.PlainMatrix)

func (*Network) CollectiveDecryptVec

func (netObj *Network) CollectiveDecryptVec(cps *crypto.CryptoParams, cv crypto.CipherVector, sourcePid int) (pv crypto.PlainVector)

func (*Network) CollectivePubKeyGen

func (netObj *Network) CollectivePubKeyGen(parameters *ckks.Parameters, skShard *ckks.SecretKey, crpGen *ring.UniformSampler) (pk *ckks.PublicKey)

func (*Network) CollectiveRelinKeyGen

func (netObj *Network) CollectiveRelinKeyGen(params *ckks.Parameters, skShard *ckks.SecretKey, crpGen *ring.UniformSampler) (evk *ckks.RelinearizationKey)

func (*Network) DisableLogging

func (netObj *Network) DisableLogging()

func (*Network) EnableLogging

func (netObj *Network) EnableLogging()

func (*Network) ExchangeCipherMatrix

func (netObj *Network) ExchangeCipherMatrix(cryptoParams *crypto.CryptoParams, cm crypto.CipherMatrix, ncv, nct int) []crypto.CipherMatrix

ExchangeCipherMatrix takes in number of vectors = len(cm) and number of cts per vec = len(cm[0])

func (*Network) ExchangeCipherVector

func (netObj *Network) ExchangeCipherVector(cryptoParams *crypto.CryptoParams, cv crypto.CipherVector, nct int) []crypto.CipherVector

ExchangeCipherVector takes in number of cts for vec

func (*Network) ExchangeCiphertext

func (netObj *Network) ExchangeCiphertext(cryptoParams *crypto.CryptoParams, ct *ckks.Ciphertext, all bool) []*ckks.Ciphertext

func (*Network) GetCRPGen

func (netObj *Network) GetCRPGen() *ring.UniformSampler

func (*Network) GetConn

func (netObj *Network) GetConn(to int, threadNum int) net.Conn

func (*Network) GetHubPid

func (netObj *Network) GetHubPid() int

func (*Network) GetNParty

func (netObj *Network) GetNParty() int

func (*Network) GetPid

func (netObj *Network) GetPid() int

func (*Network) PrintNetworkLog

func (netObj *Network) PrintNetworkLog()

func (*Network) ReceiveCipherMatrix

func (netObj *Network) ReceiveCipherMatrix(cryptoParams *crypto.CryptoParams, nv, nct, from int) crypto.CipherMatrix

ReceiveCipherMatrix reads bytes sent over conn, and unmarshals it as a ciphermatrix

func (*Network) ReceiveCipherVector

func (netObj *Network) ReceiveCipherVector(cryptoParams *crypto.CryptoParams, ncts, from int) crypto.CipherVector

ReceiveCipherVector reads bytes sent over conn, and unmarshals it as a ciphervector

func (*Network) ReceiveCiphertext

func (netObj *Network) ReceiveCiphertext(cryptoParams *crypto.CryptoParams, from int) *ckks.Ciphertext

// ReceiveCiphertext reads bytes sent over conn, and unmarshals it as a ciphertext

func (*Network) ReceiveInt

func (netObj *Network) ReceiveInt(from int) int

func (*Network) ReceiveIntVector

func (netObj *Network) ReceiveIntVector(nElem, from int) []uint64

ReceiveCipherVector reads bytes sent over conn, and unmarshals it as a ciphervector

func (*Network) ReceivePoly

func (netObj *Network) ReceivePoly(pid int) *ring.Poly

func (*Network) ReceivePolyMat

func (netObj *Network) ReceivePolyMat(pid int) [][]ring.Poly

func (*Network) ReceiveRElem

func (netObj *Network) ReceiveRElem(rtype mpc_core.RElem, p int) mpc_core.RElem

func (*Network) ReceiveRMat

func (netObj *Network) ReceiveRMat(rtype mpc_core.RElem, n, m, p int) mpc_core.RMat

ReceiveRMat receives matrix from party p

func (*Network) ReceiveRVec

func (netObj *Network) ReceiveRVec(rtype mpc_core.RElem, n, p int) mpc_core.RVec

func (*Network) ResetNetworkLog

func (netObj *Network) ResetNetworkLog()

func (*Network) SendAllCipherMatrix

func (netObj *Network) SendAllCipherMatrix(cm crypto.CipherMatrix, includeZero bool)

SendAllCipherMatrix sends ciphermatrix over to all parties

func (*Network) SendAllCipherVector

func (netObj *Network) SendAllCipherVector(cv crypto.CipherVector, includeZero bool)

SendAllCipherVector sends ciphevector over to all parties

func (*Network) SendAllCiphertext

func (netObj *Network) SendAllCiphertext(ct *ckks.Ciphertext, includeZero bool)

SendAllCiphertext sends ciphertext over to all parties

func (*Network) SendAllCryptoParams

func (netObj *Network) SendAllCryptoParams(cps *crypto.CryptoParams)

SendAllCryptoParams sends cryptoParams to all parties (receives nothing)

func (*Network) SendCipherMatrix

func (netObj *Network) SendCipherMatrix(m crypto.CipherMatrix, to int)

SendCipherMatrix sends ciphermatrix over a connection

func (*Network) SendCipherVector

func (netObj *Network) SendCipherVector(v crypto.CipherVector, to int)

SendCipherVector sends ciphervector over a connection

func (*Network) SendCiphertext

func (netObj *Network) SendCiphertext(ct *ckks.Ciphertext, to int)

SendCiphertext sends ciphertext over a connection

func (*Network) SendInt

func (netObj *Network) SendInt(val, to int)

TODO signedness lost

func (*Network) SendIntVector

func (netObj *Network) SendIntVector(v []uint64, to int)

func (*Network) SendPoly

func (netObj *Network) SendPoly(poly *ring.Poly, pid int)

func (*Network) SendPolyMat

func (netObj *Network) SendPolyMat(poly [][]ring.Poly, pid int)

func (*Network) SendRData

func (netObj *Network) SendRData(data interface{}, p int)

SendRData sends ring/field elements to party p

func (*Network) SetHubPid

func (netObj *Network) SetHubPid(p int)

func (*Network) SetMHEParams

func (netObj *Network) SetMHEParams(params *ckks.Parameters)

func (*Network) SetNParty

func (netObj *Network) SetNParty(np int)

func (*Network) SetPid

func (netObj *Network) SetPid(p int)

func (*Network) UpdateReceiverLog

func (netObj *Network) UpdateReceiverLog(fromPid int, nbytes int)

func (*Network) UpdateSenderLog

func (netObj *Network) UpdateSenderLog(toPid int, nbytes int)

type ParallelMPC

type ParallelMPC []*MPC // Holds mpc environment for each thread for parallelization

func (ParallelMPC) DisableLogging

func (mpcObjs ParallelMPC) DisableLogging()

PARALLEL ROUTINES

func (ParallelMPC) Divide

func (mpcObjs ParallelMPC) Divide(a, b mpc_core.RVec, binaryVersion bool) mpc_core.RVec

func (ParallelMPC) EnableLogging

func (mpcObjs ParallelMPC) EnableLogging()

func (ParallelMPC) GetNetworks

func (mpcObjs ParallelMPC) GetNetworks() ParallelNetworks

func (ParallelMPC) IsPositive

func (mpcObjs ParallelMPC) IsPositive(a mpc_core.RVec, binaryVersion bool) mpc_core.RVec

func (ParallelMPC) LessThan

func (mpcObjs ParallelMPC) LessThan(a, b mpc_core.RVec, binaryVersion bool) mpc_core.RVec

func (ParallelMPC) NotLessThanPublic

func (mpcObjs ParallelMPC) NotLessThanPublic(a mpc_core.RVec, b mpc_core.RElem, binaryVersion bool) mpc_core.RVec

func (ParallelMPC) RevealSymVec

func (mpcObjs ParallelMPC) RevealSymVec(a mpc_core.RVec) mpc_core.RVec

func (ParallelMPC) SSMultElemVec

func (mpcObjs ParallelMPC) SSMultElemVec(a, b mpc_core.RVec) mpc_core.RVec

func (ParallelMPC) SSSquareElemVec

func (mpcObjs ParallelMPC) SSSquareElemVec(a mpc_core.RVec) mpc_core.RVec

func (ParallelMPC) Sqrt

func (mpcObjs ParallelMPC) Sqrt(a mpc_core.RVec, binaryVersion bool) mpc_core.RVec

func (ParallelMPC) SqrtInv

func (mpcObjs ParallelMPC) SqrtInv(a mpc_core.RVec, binaryVersion bool) mpc_core.RVec

type ParallelNetworks

type ParallelNetworks []*Network

func (ParallelNetworks) CollectiveInit

func (netObj ParallelNetworks) CollectiveInit(params *ckks.Parameters, prec uint) (cps *crypto.CryptoParams)

func (ParallelNetworks) CollectiveRotKeyGen

func (netObj ParallelNetworks) CollectiveRotKeyGen(parameters *ckks.Parameters, skShard *ckks.SecretKey,
	crpGen []*ring.UniformSampler, rotTypes []crypto.RotationType) (rotKeys *ckks.RotationKeySet)

func (ParallelNetworks) PrintNetworkLog

func (netObjs ParallelNetworks) PrintNetworkLog()

func (ParallelNetworks) ResetNetworkLog

func (netObjs ParallelNetworks) ResetNetworkLog()

type Random

type Random struct {
	// contains filtered or unexported fields
}

func InitializePRG

func InitializePRG(pid int, NumParties int, sharedKeysPath string) *Random

func (*Random) CurPRG

func (rand *Random) CurPRG() *frand.RNG

func (*Random) ExportPRG

func (rand *Random) ExportPRG() []byte

func (*Random) ImportPRG

func (rand *Random) ImportPRG(buf []byte, prgId int)

func (*Random) RandElem

func (rand *Random) RandElem(rtype mpc_core.RElem) mpc_core.RElem

func (*Random) RandMat

func (rand *Random) RandMat(rtype mpc_core.RElem, r int, c int) mpc_core.RMat

func (*Random) RandMatBits

func (rand *Random) RandMatBits(rtype mpc_core.RElem, nrows, ncols, nbits int) mpc_core.RMat

Sample random numbers with bit-length nbits in rtype

func (*Random) RandRead

func (rand *Random) RandRead(buf []byte)

func (*Random) RandVec

func (rand *Random) RandVec(rtype mpc_core.RElem, n int) mpc_core.RVec

func (*Random) RandVecBits

func (rand *Random) RandVecBits(rtype mpc_core.RElem, n, nbits int) mpc_core.RVec

Sample n random numbers with bit-length nbits in rtype

func (*Random) RestorePRG

func (rand *Random) RestorePRG()

func (*Random) SwitchPRG

func (rand *Random) SwitchPRG(otherPid int)

type Server

type Server struct {
	IpAddr string
	Ports  map[string]string
}

type TypedKey

type TypedKey struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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