Documentation ¶
Index ¶
- Constants
- func CSigmoidApprox(sourcePid int, net *Network, cryptoParams *crypto.CryptoParams, ...) crypto.CipherVector
- func CloseChannel(conn net.Conn)
- func Connect(ip, port string) net.Conn
- func InitializeParallelPRG(sharedKeysPath string, network []*Network, pid int, nparties int)
- func MarshalCV(cv crypto.CipherVector) ([]byte, []byte)
- func MarshalPolyMat(polys [][]ring.Poly) ([]byte, []byte)
- func MarshalRData(val interface{}) []byte
- func OpenChannel(ip, port string) (net.Conn, net.Listener)
- func ReadFull(conn *net.Conn, buf []byte)
- func SaveBytesToFile(b []byte, filename string)
- func SaveMatrixToFileWithPrint(cps *crypto.CryptoParams, mpcObj *MPC, cm crypto.CipherMatrix, nElemCol int, ...)
- func SaveMatrixToFileWithPrintIndex(cps *crypto.CryptoParams, mpcObj *MPC, cm crypto.CipherMatrix, nElemCol int, ...)
- func Sigmoid(x complex128) complex128
- func SigmoidApprox(sourcePid int, net *Network, cryptoParams *crypto.CryptoParams, ...) *ckks.Ciphertext
- func UnmarshalCV(cryptoParams *crypto.CryptoParams, ncts int, sbytes, ctbytes []byte) crypto.CipherVector
- func UnmarshalPolyMat(sizes, bytes []byte) [][]ring.Poly
- func WriteFull(conn *net.Conn, buf []byte)
- type MPC
- func (mpcObj *MPC) AssertSync()
- func (mpcObj *MPC) BeaverMult(ar, am, br, bm mpc_core.RElem) mpc_core.RElem
- func (mpcObj *MPC) BeaverMultElemMat(ar, am, br, bm mpc_core.RMat) mpc_core.RMat
- func (mpcObj *MPC) BeaverMultElemVec(ar, am, br, bm mpc_core.RVec) mpc_core.RVec
- func (mpcObj *MPC) BeaverMultMat(ar, am, br, bm mpc_core.RMat) mpc_core.RMat
- func (mpcObj *MPC) BeaverPartition(a mpc_core.RElem) (mpc_core.RElem, mpc_core.RElem)
- func (mpcObj *MPC) BeaverPartitionMat(a mpc_core.RMat) (mpc_core.RMat, mpc_core.RMat)
- func (mpcObj *MPC) BeaverPartitionVec(a mpc_core.RVec) (mpc_core.RVec, mpc_core.RVec)
- func (mpcObj *MPC) BeaverReconstruct(a mpc_core.RElem) mpc_core.RElem
- func (mpcObj *MPC) BeaverReconstructMat(a mpc_core.RMat) mpc_core.RMat
- func (mpcObj *MPC) BeaverReconstructVec(a mpc_core.RVec) mpc_core.RVec
- func (mpcObj *MPC) BinaryAddPublic(aPub mpc_core.RMat, b mpc_core.RMat, numBits int) mpc_core.RMat
- func (mpcObj *MPC) BinaryPrefixOr(a mpc_core.RMat, numBits int) mpc_core.RMat
- func (mpcObj *MPC) CMatToSS(cryptoParams *crypto.CryptoParams, rtype mpc_core.RElem, ...) (rm mpc_core.RMat)
- func (mpcObj *MPC) CVecToSS(cryptoParams *crypto.CryptoParams, rtype mpc_core.RElem, ...) (rm mpc_core.RVec)
- func (mpcObj *MPC) CarryOutAux(dProp mpc_core.RMat, dGen mpc_core.RMat, numBits int) mpc_core.RVec
- func (mpcObj *MPC) CarryOutPublic(aPub mpc_core.RMat, b mpc_core.RMat, numBits int) mpc_core.RVec
- func (mpcObj *MPC) CarryOverPublic(aPub mpc_core.RMat, b mpc_core.RMat, numBits int) mpc_core.RMat
- func (mpcObj *MPC) CiphertextToSS(cryptoParams *crypto.CryptoParams, rtype mpc_core.RElem, ct *ckks.Ciphertext, ...) (rv mpc_core.RVec)
- func (mpcObj *MPC) Divide(a, b mpc_core.RVec, binaryVersion bool) mpc_core.RVec
- func (mpcObj *MPC) EigenDecomp(A mpc_core.RMat) (V mpc_core.RMat, L mpc_core.RVec)
- func (mpcObj *MPC) EvaluatePoly(a mpc_core.RVec, coeff mpc_core.RMat) mpc_core.RMat
- func (mpcObj *MPC) FanInOr(a mpc_core.RMat) mpc_core.RVec
- func (mpcObj *MPC) FlipBit(a mpc_core.RVec) mpc_core.RVec
- func (mpcObj *MPC) GetBooleanShareFlag() bool
- func (mpcObj *MPC) GetCRPGen() *ring.UniformSampler
- func (mpcObj *MPC) GetDataBits() int
- func (mpcObj *MPC) GetFracBits() int
- func (mpcObj *MPC) GetHubPid() int
- func (mpcObj *MPC) GetMHEContext() *dckks.Context
- func (mpcObj *MPC) GetNParty() int
- func (mpcObj *MPC) GetPascalMatrix(rtype mpc_core.RElem, pow int) mpc_core.RMat
- func (mpcObj *MPC) GetPid() int
- func (mpcObj *MPC) GetRType() mpc_core.RElem
- func (mpcObj *MPC) Householder(x mpc_core.RVec) mpc_core.RVec
- func (mpcObj *MPC) InitLagrangeCache()
- func (mpcObj *MPC) IsPositive(a mpc_core.RVec, binaryVersion bool) mpc_core.RVec
- func (mpcObj *MPC) IsPositive2N(x mpc_core.RVec) mpc_core.RVec
- func (mpcObj *MPC) LessThan(a, b mpc_core.RVec, binaryVersion bool) mpc_core.RVec
- func (mpcObj *MPC) LessThanBits(a, b mpc_core.RMat) mpc_core.RVec
- func (mpcObj *MPC) LessThanBitsAux(a, b mpc_core.RMat, isPublic bool) mpc_core.RVec
- func (mpcObj *MPC) LessThanBitsPublic(a, bpub mpc_core.RMat) mpc_core.RVec
- func (mpcObj *MPC) LessThanPublic(a mpc_core.RVec, bpub mpc_core.RElem, binaryVersion bool) mpc_core.RVec
- func (mpcObj *MPC) MatrixInverseSVD(A mpc_core.RMat) (AInv mpc_core.RMat)
- func (mpcObj *MPC) MatrixInverseSqrtSVD(A mpc_core.RMat) (AInvSqrt mpc_core.RMat)
- func (mpcObj *MPC) MatrixInverseSymPos(ASymPosDef mpc_core.RMat) (AInv, AInvSqrt mpc_core.RMat)
- func (mpcObj *MPC) NormalizerEvenExp(a mpc_core.RVec, k int) (mpc_core.RVec, mpc_core.RVec)
- func (mpcObj *MPC) NormalizerEvenExp2N(x mpc_core.RVec, k int) (mpc_core.RVec, mpc_core.RVec)
- func (mpcObj *MPC) NotLessThan(a, b mpc_core.RVec, binaryVersion bool) mpc_core.RVec
- func (mpcObj *MPC) NotLessThanPublic(a mpc_core.RVec, bpub mpc_core.RElem, binaryVersion bool) mpc_core.RVec
- func (mpcObj *MPC) Powers(a mpc_core.RVec, pow int) mpc_core.RMat
- func (mpcObj *MPC) PrefixOr(a mpc_core.RMat) mpc_core.RMat
- func (mpcObj *MPC) QRFactSquare(A mpc_core.RMat) (Q, R mpc_core.RMat)
- func (mpcObj *MPC) RevealSym(a mpc_core.RElem) mpc_core.RElem
- func (mpcObj *MPC) RevealSymMat(a mpc_core.RMat) mpc_core.RMat
- func (mpcObj *MPC) RevealSymVec(a mpc_core.RVec) mpc_core.RVec
- func (mpcObj *MPC) SSMultElemMat(a, b mpc_core.RMat) mpc_core.RMat
- func (mpcObj *MPC) SSMultElemVec(a, b mpc_core.RVec) mpc_core.RVec
- func (mpcObj *MPC) SSMultElemVecScalar(a mpc_core.RVec, b mpc_core.RElem) mpc_core.RVec
- func (mpcObj *MPC) SSMultMat(a, b mpc_core.RMat) mpc_core.RMat
- func (mpcObj *MPC) SSSquareElemVec(a mpc_core.RVec) mpc_core.RVec
- func (mpcObj *MPC) SSToCMat(cryptoParams *crypto.CryptoParams, rm mpc_core.RMat) (cm crypto.CipherMatrix)
- func (mpcObj *MPC) SSToCVec(cryptoParams *crypto.CryptoParams, rv mpc_core.RVec) (cv crypto.CipherVector)
- func (mpcObj *MPC) SStoCiphertext(cryptoParams *crypto.CryptoParams, rv mpc_core.RVec) *ckks.Ciphertext
- func (mpcObj *MPC) SetBooleanShareFlag(flag bool)
- func (mpcObj *MPC) SetDivSqrtMaxLen(num int)
- func (mpcObj *MPC) SetFracBits(f int)
- func (mpcObj *MPC) SetHubPid(p int)
- func (mpcObj *MPC) SetNParty(np int)
- func (mpcObj *MPC) SetPid(p int)
- func (mpcObj *MPC) ShareRandomBits(rtype, rtypeBit mpc_core.RElem, n, nbitsOut, nbitsSample int, bitSample bool) (mpc_core.RVec, mpc_core.RMat)
- func (mpcObj *MPC) SortRowsDescend(A mpc_core.RMat, w mpc_core.RVec) (ASorted mpc_core.RMat, wSorted mpc_core.RVec)
- func (mpcObj *MPC) SqrtAndSqrtInverse(a mpc_core.RVec, binaryVersion bool) (b, bInv mpc_core.RVec)
- func (mpcObj *MPC) SuffixCarryAux(dProp mpc_core.RMat, dGen mpc_core.RMat, numBits int) mpc_core.RMat
- 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 (mpcObj *MPC) TableLookup(a mpc_core.RVec, tableId int) mpc_core.RMat
- func (mpcObj *MPC) TableLookupWithShareConversion(rtypeOut mpc_core.RElem, a mpc_core.RVec, tableId int) mpc_core.RMat
- func (mpcObj *MPC) Tridiag(A mpc_core.RMat) (T, Q mpc_core.RMat)
- func (mpcObj *MPC) Trunc(a mpc_core.RElem, k, m int) mpc_core.RElem
- func (mpcObj *MPC) TruncMat(a mpc_core.RMat, k, m int) mpc_core.RMat
- func (mpcObj *MPC) TruncVec(a mpc_core.RVec, k, m int) mpc_core.RVec
- type MpcRoutine
- type Network
- func (netObj *Network) AggregateCMat(cryptoParams *crypto.CryptoParams, mat crypto.CipherMatrix) (out crypto.CipherMatrix)
- func (netObj *Network) AggregateCText(cryptoParams *crypto.CryptoParams, val *ckks.Ciphertext) (out *ckks.Ciphertext)
- func (netObj *Network) AggregateCVec(cryptoParams *crypto.CryptoParams, vec crypto.CipherVector) crypto.CipherVector
- func (netObj *Network) AggregateDecryptShares(poly *dckks.PCKSShare, outLevel int) (out *dckks.PCKSShare)
- func (netObj *Network) AggregateDecryptSharesMat(poly [][]dckks.PCKSShare, outLevel int) (out [][]dckks.PCKSShare)
- func (netObj *Network) AggregateIntVec(vec []uint64) (out []uint64)
- func (netObj *Network) AggregatePubKeyShares(poly *drlwe.CKGShare) (out *drlwe.CKGShare)
- func (netObj *Network) AggregateRefreshShare(share *ring.Poly, outLevel int) (shareOut *ring.Poly)
- func (netObj *Network) AggregateRefreshShareMat(share [][]ring.Poly, outLevel int) (shareOut [][]ring.Poly)
- func (netObj *Network) AggregateRefreshShareVec(share []*ring.Poly, outLevel int) (shareOut []*ring.Poly)
- func (netObj *Network) AggregateRelinKeyShare(share *drlwe.RKGShare, secondSlot bool) (shareOut *drlwe.RKGShare)
- func (netObj *Network) AggregateRotKeyShare(share *drlwe.RTGShare) (shareOut *drlwe.RTGShare)
- func (netObj *Network) AggregateSharesCT(cryptoParams *crypto.CryptoParams, ct *ckks.Ciphertext) *ckks.Ciphertext
- func (netObj *Network) BootstrapMatAll(cps *crypto.CryptoParams, cm crypto.CipherMatrix) crypto.CipherMatrix
- func (netObj *Network) BootstrapVecAll(cps *crypto.CryptoParams, cv crypto.CipherVector) crypto.CipherVector
- func (netObj *Network) BroadcastCMat(cps *crypto.CryptoParams, cm crypto.CipherMatrix, sourcePid int, ...) crypto.CipherMatrix
- func (netObj *Network) BroadcastCVec(cps *crypto.CryptoParams, cv crypto.CipherVector, sourcePid int, numCtx int) crypto.CipherVector
- func (netObj *Network) BroadcastCiphertext(cps *crypto.CryptoParams, ct *ckks.Ciphertext, sourcePid int) *ckks.Ciphertext
- func (netObj *Network) CloseAll()
- func (netObj *Network) CollectiveBootstrap(cps *crypto.CryptoParams, ct *ckks.Ciphertext, sourcePid int)
- func (netObj *Network) CollectiveBootstrapMat(cps *crypto.CryptoParams, cm crypto.CipherMatrix, sourcePid int) crypto.CipherMatrix
- func (netObj *Network) CollectiveBootstrapVec(cps *crypto.CryptoParams, cv crypto.CipherVector, sourcePid int) crypto.CipherVector
- func (netObj *Network) CollectiveDecrypt(cps *crypto.CryptoParams, ct *ckks.Ciphertext, sourcePid int) (pt *ckks.Plaintext)
- func (netObj *Network) CollectiveDecryptMat(cps *crypto.CryptoParams, cm crypto.CipherMatrix, sourcePid int) (pm crypto.PlainMatrix)
- func (netObj *Network) CollectiveDecryptVec(cps *crypto.CryptoParams, cv crypto.CipherVector, sourcePid int) (pv crypto.PlainVector)
- func (netObj *Network) CollectivePubKeyGen(parameters *ckks.Parameters, skShard *ckks.SecretKey, ...) (pk *ckks.PublicKey)
- func (netObj *Network) CollectiveRelinKeyGen(params *ckks.Parameters, skShard *ckks.SecretKey, crpGen *ring.UniformSampler) (evk *ckks.RelinearizationKey)
- func (netObj *Network) DisableLogging()
- func (netObj *Network) EnableLogging()
- func (netObj *Network) ExchangeCipherMatrix(cryptoParams *crypto.CryptoParams, cm crypto.CipherMatrix, ncv, nct int) []crypto.CipherMatrix
- func (netObj *Network) ExchangeCipherVector(cryptoParams *crypto.CryptoParams, cv crypto.CipherVector, nct int) []crypto.CipherVector
- func (netObj *Network) ExchangeCiphertext(cryptoParams *crypto.CryptoParams, ct *ckks.Ciphertext, all bool) []*ckks.Ciphertext
- func (netObj *Network) GetCRPGen() *ring.UniformSampler
- func (netObj *Network) GetConn(to int, threadNum int) net.Conn
- func (netObj *Network) GetHubPid() int
- func (netObj *Network) GetNParty() int
- func (netObj *Network) GetPid() int
- func (netObj *Network) PrintNetworkLog()
- func (netObj *Network) ReceiveCipherMatrix(cryptoParams *crypto.CryptoParams, nv, nct, from int) crypto.CipherMatrix
- func (netObj *Network) ReceiveCipherVector(cryptoParams *crypto.CryptoParams, ncts, from int) crypto.CipherVector
- func (netObj *Network) ReceiveCiphertext(cryptoParams *crypto.CryptoParams, from int) *ckks.Ciphertext
- func (netObj *Network) ReceiveInt(from int) int
- func (netObj *Network) ReceiveIntVector(nElem, from int) []uint64
- func (netObj *Network) ReceivePoly(pid int) *ring.Poly
- func (netObj *Network) ReceivePolyMat(pid int) [][]ring.Poly
- func (netObj *Network) ReceiveRElem(rtype mpc_core.RElem, p int) mpc_core.RElem
- func (netObj *Network) ReceiveRMat(rtype mpc_core.RElem, n, m, p int) mpc_core.RMat
- func (netObj *Network) ReceiveRVec(rtype mpc_core.RElem, n, p int) mpc_core.RVec
- func (netObj *Network) ResetNetworkLog()
- func (netObj *Network) SendAllCipherMatrix(cm crypto.CipherMatrix, includeZero bool)
- func (netObj *Network) SendAllCipherVector(cv crypto.CipherVector, includeZero bool)
- func (netObj *Network) SendAllCiphertext(ct *ckks.Ciphertext, includeZero bool)
- func (netObj *Network) SendAllCryptoParams(cps *crypto.CryptoParams)
- func (netObj *Network) SendCipherMatrix(m crypto.CipherMatrix, to int)
- func (netObj *Network) SendCipherVector(v crypto.CipherVector, to int)
- func (netObj *Network) SendCiphertext(ct *ckks.Ciphertext, to int)
- func (netObj *Network) SendInt(val, to int)
- func (netObj *Network) SendIntVector(v []uint64, to int)
- func (netObj *Network) SendPoly(poly *ring.Poly, pid int)
- func (netObj *Network) SendPolyMat(poly [][]ring.Poly, pid int)
- func (netObj *Network) SendRData(data interface{}, p int)
- func (netObj *Network) SetHubPid(p int)
- func (netObj *Network) SetMHEParams(params *ckks.Parameters)
- func (netObj *Network) SetNParty(np int)
- func (netObj *Network) SetPid(p int)
- func (netObj *Network) UpdateReceiverLog(fromPid int, nbytes int)
- func (netObj *Network) UpdateSenderLog(toPid int, nbytes int)
- type ParallelMPC
- func (mpcObjs ParallelMPC) DisableLogging()
- func (mpcObjs ParallelMPC) Divide(a, b mpc_core.RVec, binaryVersion bool) mpc_core.RVec
- func (mpcObjs ParallelMPC) EnableLogging()
- func (mpcObjs ParallelMPC) GetNetworks() ParallelNetworks
- func (mpcObjs ParallelMPC) IsPositive(a mpc_core.RVec, binaryVersion bool) mpc_core.RVec
- func (mpcObjs ParallelMPC) LessThan(a, b mpc_core.RVec, binaryVersion bool) mpc_core.RVec
- func (mpcObjs ParallelMPC) NotLessThanPublic(a mpc_core.RVec, b mpc_core.RElem, binaryVersion bool) mpc_core.RVec
- func (mpcObjs ParallelMPC) RevealSymVec(a mpc_core.RVec) mpc_core.RVec
- func (mpcObjs ParallelMPC) SSMultElemVec(a, b mpc_core.RVec) mpc_core.RVec
- func (mpcObjs ParallelMPC) SSSquareElemVec(a mpc_core.RVec) mpc_core.RVec
- func (mpcObjs ParallelMPC) Sqrt(a mpc_core.RVec, binaryVersion bool) mpc_core.RVec
- func (mpcObjs ParallelMPC) SqrtInv(a mpc_core.RVec, binaryVersion bool) mpc_core.RVec
- type ParallelNetworks
- func (netObj ParallelNetworks) CollectiveInit(params *ckks.Parameters, prec uint) (cps *crypto.CryptoParams)
- func (netObj ParallelNetworks) CollectiveRotKeyGen(parameters *ckks.Parameters, skShard *ckks.SecretKey, ...) (rotKeys *ckks.RotationKeySet)
- func (netObjs ParallelNetworks) PrintNetworkLog()
- func (netObjs ParallelNetworks) ResetNetworkLog()
- type Random
- func (rand *Random) CurPRG() *frand.RNG
- func (rand *Random) ExportPRG() []byte
- func (rand *Random) ImportPRG(buf []byte, prgId int)
- func (rand *Random) RandElem(rtype mpc_core.RElem) mpc_core.RElem
- func (rand *Random) RandMat(rtype mpc_core.RElem, r int, c int) mpc_core.RMat
- func (rand *Random) RandMatBits(rtype mpc_core.RElem, nrows, ncols, nbits int) mpc_core.RMat
- func (rand *Random) RandRead(buf []byte)
- func (rand *Random) RandVec(rtype mpc_core.RElem, n int) mpc_core.RVec
- func (rand *Random) RandVecBits(rtype mpc_core.RElem, n, nbits int) mpc_core.RVec
- func (rand *Random) RestorePRG()
- func (rand *Random) SwitchPRG(otherPid int)
- type Server
- type TypedKey
Constants ¶
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 InitializeParallelPRG ¶
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 MarshalRData ¶
func MarshalRData(val interface{}) []byte
func OpenChannel ¶
OpenChannel opens channel at specificed ip address and port and returns channel (server side, connection for client to listen to)
func SaveBytesToFile ¶
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 ¶
Types ¶
type MPC ¶
type MPC struct { Network *Network // contains filtered or unexported fields }
func InitParallelMPCEnv ¶
func (*MPC) AssertSync ¶
func (mpcObj *MPC) AssertSync()
func (*MPC) BeaverMult ¶
func (*MPC) BeaverMultElemMat ¶
func (*MPC) BeaverMultElemVec ¶
func (*MPC) BeaverMultMat ¶
func (*MPC) BeaverPartition ¶
func (*MPC) BeaverPartitionMat ¶
Returns ar, am
func (*MPC) BeaverPartitionVec ¶
func (*MPC) BeaverReconstruct ¶
func (*MPC) BeaverReconstructMat ¶
func (*MPC) BeaverReconstructVec ¶
func (*MPC) BinaryAddPublic ¶
func (*MPC) BinaryPrefixOr ¶
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 (*MPC) CarryOutPublic ¶
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 ¶
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) EigenDecomp ¶
func (*MPC) EvaluatePoly ¶
func (*MPC) GetBooleanShareFlag ¶
func (*MPC) GetCRPGen ¶
func (mpcObj *MPC) GetCRPGen() *ring.UniformSampler
func (*MPC) GetDataBits ¶
func (*MPC) GetFracBits ¶
func (*MPC) GetMHEContext ¶
func (*MPC) GetPascalMatrix ¶
GetPascalMat retrieves the pascal matrix associated with the given power
func (*MPC) Householder ¶
Linear algebra routines for eigen-decomposition
func (*MPC) InitLagrangeCache ¶
func (mpcObj *MPC) InitLagrangeCache()
func (*MPC) IsPositive ¶
func (*MPC) IsPositive2N ¶
Assumes x is LElem256 or LElem128 for now
func (*MPC) LessThanBitsAux ¶
b is public if isPublic = true,
func (*MPC) LessThanBitsPublic ¶
b is public
func (*MPC) LessThanPublic ¶
func (*MPC) MatrixInverseSVD ¶
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 ¶
Takes input A and returns B such that B^T * B = A Requirement: A is symmetric
func (*MPC) MatrixInverseSymPos ¶
Assumes A is a symmetric, positive definite matrix (positive eigenvalues) Outputs both AInv and AInvSqrt, where AInv = AInvSqrt' * AInvSqrt
func (*MPC) NormalizerEvenExp ¶
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 (*MPC) NotLessThan ¶
func (*MPC) NotLessThanPublic ¶
func (*MPC) SSMultElemVecScalar ¶
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 (*MPC) SetDivSqrtMaxLen ¶
func (*MPC) SetFracBits ¶
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 (*MPC) SqrtAndSqrtInverse ¶
Assumes K - F is even
func (*MPC) SuffixCarryAux ¶
func (*MPC) TableLookup ¶
func (*MPC) TableLookupWithShareConversion ¶
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 (*Network) AggregateIntVec ¶
func (*Network) AggregatePubKeyShares ¶
func (*Network) AggregateRefreshShare ¶
func (*Network) AggregateRefreshShareMat ¶
func (*Network) AggregateRefreshShareVec ¶
func (*Network) AggregateRelinKeyShare ¶
func (*Network) AggregateRotKeyShare ¶
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) 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) 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 (*Network) ReceiveIntVector ¶
ReceiveCipherVector reads bytes sent over conn, and unmarshals it as a ciphervector
func (*Network) ReceiveRElem ¶
func (*Network) ReceiveRMat ¶
ReceiveRMat receives matrix from party p
func (*Network) ReceiveRVec ¶
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) SendIntVector ¶
func (*Network) SetMHEParams ¶
func (netObj *Network) SetMHEParams(params *ckks.Parameters)
func (*Network) UpdateReceiverLog ¶
func (*Network) UpdateSenderLog ¶
type ParallelMPC ¶
type ParallelMPC []*MPC // Holds mpc environment for each thread for parallelization
func (ParallelMPC) EnableLogging ¶
func (mpcObjs ParallelMPC) EnableLogging()
func (ParallelMPC) GetNetworks ¶
func (mpcObjs ParallelMPC) GetNetworks() ParallelNetworks
func (ParallelMPC) IsPositive ¶
func (ParallelMPC) NotLessThanPublic ¶
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
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 (*Random) RandMatBits ¶
Sample random numbers with bit-length nbits in rtype
func (*Random) RandVecBits ¶
Sample n random numbers with bit-length nbits in rtype
func (*Random) RestorePRG ¶
func (rand *Random) RestorePRG()