mpc_core

package module
v0.0.0-...-24cf7ab Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2022 License: Apache-2.0 Imports: 6 Imported by: 9

README

mpc-core

Documentation

Index

Constants

View Source
const BElemUniqueID uint8 = 6
View Source
const LElem128Bytes uint32 = 16
View Source
const LElem128UniqueID uint8 = 4
View Source
const LElem256Bytes uint32 = 32 // Extra byte for sign bit for ease of marshalling
View Source
const LElem256UniqueID uint8 = 5
View Source
const LElem2NBigIntUniqueID uint8 = 7
View Source
const LElem2NBytes uint32 = uint32(unsafe.Sizeof(LElem2N(0)))
View Source
const LElem2NUniqueID uint8 = 0
View Source
const LElemPBytes uint32 = uint32(unsafe.Sizeof(LElemP(0)))
View Source
const LElemPMod64 uint64 = uint64(LElemPMod)
View Source
const LElemPUniqueID uint8 = 1
View Source
const SElemCBytes uint32 = uint32(unsafe.Sizeof(SElemC(0)))
View Source
const SElemCMod16 uint16 = uint16(SElemCMod)
View Source
const SElemCUniqueID uint8 = 3
View Source
const SElemDSBytes uint32 = uint32(unsafe.Sizeof(SElemDS(0)))
View Source
const SElemDSMod16 uint16 = uint16(SElemDSMod)
View Source
const SElemDSUniqueID uint8 = 2

Variables

View Source
var BElemBits int = int(8 * BElemBytes)
View Source
var BElemBytes uint32 = uint32(unsafe.Sizeof(BElem(0)))
View Source
var LElem128MFormNInv = LElem128Zero.FromBigInt(new(big.Int).Sub(new(big.Int).Lsh(big.NewInt(1), 128), new(big.Int).ModInverse(LElem128ModBig, new(big.Int).Lsh(big.NewInt(1), 128))))
View Source
var LElem128MFormR2 = LElem128Zero.FromBigInt(new(big.Int).Mod(new(big.Int).Lsh(big.NewInt(1), 2*128), LElem128ModBig))
View Source
var LElem128ModBig *big.Int = big.NewInt(0).Sub(big.NewInt(0).Exp(big.NewInt(2), big.NewInt(127), nil), big.NewInt(1))
View Source
var LElem128ModBitLen int = bits.Len64(LElem128Mod.Hi) + 64
View Source
var LElem128ModHalfBig *big.Int = big.NewInt(0).Exp(big.NewInt(2), big.NewInt(126), nil)
View Source
var LElem256Mod = LElem256{new(big.Int).Sub(big.NewInt(0).Lsh(big.NewInt(1), 256), big.NewInt(189))} // 2^256 - 189
View Source
var LElem256ModBitLen int = (LElem256Mod).Val.BitLen()
View Source
var LElem256ModHalf = LElem256{new(big.Int).Sub(big.NewInt(0).Lsh(big.NewInt(1), 255), big.NewInt(94))} // 2^255 - 94
View Source
var LElem2NBigIntModBitLen int // Variable set on the fly
View Source
var LElem2NModBig *big.Int = big.NewInt(0).Add(big.NewInt(0).SetUint64(^uint64(0)), big.NewInt(1))
View Source
var LElem2NModBitLen int = 65
View Source
var LElemPModBig *big.Int = big.NewInt(0).SetUint64(uint64(LElemPMod))
View Source
var LElemPModBitLen int = bits.Len64(uint64(LElemPMod))
View Source
var SElemCModBig *big.Int = big.NewInt(0).SetUint64(uint64(SElemCMod))
View Source
var SElemCModBitLen int = bits.Len64(uint64(SElemCMod))
View Source
var SElemDSModBig *big.Int = big.NewInt(0).SetUint64(uint64(SElemDSMod))
View Source
var SElemDSModBitLen int = bits.Len64(uint64(SElemDSMod))

Functions

This section is empty.

Types

type BElem

type BElem uint64

Bitwise sharing

func (BElem) Add

func (a BElem) Add(b interface{}) RElem

func (BElem) AssertTypeFor

func (a BElem) AssertTypeFor(n RElem) RElem

func (BElem) Copy

func (a BElem) Copy() RElem

func (BElem) Float64

func (a BElem) Float64(fracBits int) float64

func (BElem) FromBigInt

func (a BElem) FromBigInt(n *big.Int) RElem

func (BElem) FromBytes

func (a BElem) FromBytes(buf []byte) RElem

func (BElem) FromFloat64

func (a BElem) FromFloat64(n float64, fracBits int) RElem

func (BElem) FromInt

func (a BElem) FromInt(n int) RElem

func (BElem) FromUint64

func (a BElem) FromUint64(n uint64) RElem

func (BElem) GetBit

func (a BElem) GetBit(posFromLSB int) uint

func (BElem) Inv

func (a BElem) Inv() RElem

func (BElem) ModBitLength

func (a BElem) ModBitLength() int

func (BElem) Modulus

func (a BElem) Modulus() *big.Int

func (BElem) Mul

func (a BElem) Mul(b interface{}) RElem

func (BElem) Neg

func (a BElem) Neg() RElem

func (BElem) NumBytes

func (a BElem) NumBytes() uint32

func (BElem) One

func (a BElem) One() RElem

func (BElem) Rand

func (a BElem) Rand(prg *frand.RNG) RElem

func (BElem) RandBits

func (a BElem) RandBits(prg *frand.RNG, nbits int) RElem

func (BElem) Sub

func (a BElem) Sub(b interface{}) RElem

func (BElem) ToBytes

func (a BElem) ToBytes(buf []byte)

func (BElem) Trunc

func (a BElem) Trunc(nBits int) RElem

func (BElem) TypeID

func (a BElem) TypeID() uint8

func (BElem) Uint64

func (a BElem) Uint64() uint64

func (BElem) Zero

func (a BElem) Zero() RElem

type LElem128

type LElem128 Uint128
var LElem128Mod LElem128 = LElem128{9223372036854775807, 18446744073709551615} // 2^127 - 1
var LElem128ModHalf LElem128 = LElem128{4611686018427387904, 0} // 2^126
var LElem128RandBnd LElem128 = initLElem128RandBnd()
var LElem128Zero LElem128 = LElem128{0, 0}

func (LElem128) Add

func (a LElem128) Add(b interface{}) RElem

func (LElem128) AssertTypeFor

func (a LElem128) AssertTypeFor(n RElem) RElem

func (LElem128) Copy

func (a LElem128) Copy() RElem

func (LElem128) ExitMForm

func (a LElem128) ExitMForm() RElem

func (LElem128) Float64

func (a LElem128) Float64(fracBits int) float64

func (LElem128) FromBigFloat

func (a LElem128) FromBigFloat(n *big.Float, fracBits int) RElem

func (LElem128) FromBigInt

func (a LElem128) FromBigInt(n *big.Int) RElem

func (LElem128) FromBytes

func (a LElem128) FromBytes(buf []byte) RElem

func (LElem128) FromFloat64

func (a LElem128) FromFloat64(n float64, fracBits int) RElem

func (LElem128) FromInt

func (a LElem128) FromInt(n int) RElem

func (LElem128) FromUint64

func (a LElem128) FromUint64(n uint64) RElem

func (LElem128) GetBit

func (a LElem128) GetBit(posFromLSB int) uint

func (LElem128) Inv

func (a LElem128) Inv() RElem

func (LElem128) MForm

func (a LElem128) MForm() RElem

func (LElem128) ModBitLength

func (a LElem128) ModBitLength() int

func (LElem128) Modulus

func (a LElem128) Modulus() *big.Int

func (LElem128) Mul

func (a LElem128) Mul(b interface{}) RElem

func (LElem128) MulMForm

func (a LElem128) MulMForm(b interface{}) RElem

func (LElem128) Neg

func (a LElem128) Neg() RElem

func (LElem128) NumBytes

func (a LElem128) NumBytes() uint32

func (LElem128) One

func (a LElem128) One() RElem

func (LElem128) REDC

func (a LElem128) REDC(hi, lo Uint128) RElem

REDC algorithm for modular arithmetic in Montgomery form

func (LElem128) Rand

func (a LElem128) Rand(prg *frand.RNG) RElem

func (LElem128) RandBits

func (a LElem128) RandBits(prg *frand.RNG, nbits int) RElem

func (LElem128) Sub

func (a LElem128) Sub(b interface{}) RElem

func (LElem128) ToBigFloat

func (a LElem128) ToBigFloat(fracBits int) *big.Float

func (LElem128) ToBigInt

func (a LElem128) ToBigInt() *big.Int

func (LElem128) ToBytes

func (a LElem128) ToBytes(buf []byte)

func (LElem128) ToSignedBigFloat

func (a LElem128) ToSignedBigFloat(fracBits int) *big.Float

func (LElem128) ToSignedBigInt

func (a LElem128) ToSignedBigInt() *big.Int

func (LElem128) Trunc

func (a LElem128) Trunc(nBits int) RElem

func (LElem128) TypeID

func (a LElem128) TypeID() uint8

func (LElem128) Uint64

func (a LElem128) Uint64() uint64

func (LElem128) Zero

func (a LElem128) Zero() RElem

type LElem256

type LElem256 struct {
	Val *big.Int
}
var LElem256Zero LElem256 = LElem256{big.NewInt(0)}

func (LElem256) Add

func (a LElem256) Add(b interface{}) RElem

func (LElem256) AssertTypeFor

func (a LElem256) AssertTypeFor(n RElem) RElem

func (LElem256) Copy

func (a LElem256) Copy() RElem

func (LElem256) Float64

func (a LElem256) Float64(fracBits int) float64

func (LElem256) FromBigFloat

func (a LElem256) FromBigFloat(n *big.Float, fracBits int) RElem

func (LElem256) FromBigInt

func (a LElem256) FromBigInt(n *big.Int) RElem

func (LElem256) FromBytes

func (a LElem256) FromBytes(buf []byte) RElem

func (LElem256) FromFloat64

func (a LElem256) FromFloat64(n float64, fracBits int) RElem

func (LElem256) FromInt

func (a LElem256) FromInt(n int) RElem

func (LElem256) FromUint64

func (a LElem256) FromUint64(n uint64) RElem

func (LElem256) GetBit

func (a LElem256) GetBit(posFromLSB int) uint

func (LElem256) Inv

func (a LElem256) Inv() RElem

func (LElem256) ModBitLength

func (a LElem256) ModBitLength() int

func (LElem256) Modulus

func (a LElem256) Modulus() *big.Int

func (LElem256) Mul

func (a LElem256) Mul(b interface{}) RElem

func (LElem256) Neg

func (a LElem256) Neg() RElem

func (LElem256) NumBytes

func (a LElem256) NumBytes() uint32

func (LElem256) One

func (a LElem256) One() RElem

func (LElem256) Rand

func (a LElem256) Rand(prg *frand.RNG) RElem

func (LElem256) RandBits

func (a LElem256) RandBits(prg *frand.RNG, nbits int) RElem

func (LElem256) Sub

func (a LElem256) Sub(b interface{}) RElem

func (LElem256) ToBigFloat

func (a LElem256) ToBigFloat(fracBits int) *big.Float

func (LElem256) ToBigInt

func (a LElem256) ToBigInt() *big.Int

func (LElem256) ToBytes

func (a LElem256) ToBytes(buf []byte)

func (LElem256) ToSignedBigFloat

func (a LElem256) ToSignedBigFloat(fracBits int) *big.Float

func (LElem256) ToSignedBigInt

func (a LElem256) ToSignedBigInt() *big.Int

func (LElem256) Trunc

func (a LElem256) Trunc(nBits int) RElem

func (LElem256) TypeID

func (a LElem256) TypeID() uint8

func (LElem256) Uint64

func (a LElem256) Uint64() uint64

func (LElem256) Zero

func (a LElem256) Zero() RElem

type LElem2N

type LElem2N uint64

Large ring with power of two modulus

var LElem2NModHalf LElem2N = LElem2N(uint64(1) << 63)

func (LElem2N) Add

func (a LElem2N) Add(b interface{}) RElem

func (LElem2N) AssertTypeFor

func (a LElem2N) AssertTypeFor(n RElem) RElem

func (LElem2N) Copy

func (a LElem2N) Copy() RElem

func (LElem2N) Float64

func (a LElem2N) Float64(fracBits int) float64

func (LElem2N) FromBigInt

func (a LElem2N) FromBigInt(n *big.Int) RElem

func (LElem2N) FromBytes

func (a LElem2N) FromBytes(buf []byte) RElem

func (LElem2N) FromFloat64

func (a LElem2N) FromFloat64(n float64, fracBits int) RElem

func (LElem2N) FromInt

func (a LElem2N) FromInt(n int) RElem

func (LElem2N) FromUint64

func (a LElem2N) FromUint64(n uint64) RElem

func (LElem2N) GetBit

func (a LElem2N) GetBit(posFromLSB int) uint

func (LElem2N) Inv

func (a LElem2N) Inv() RElem

func (LElem2N) ModBitLength

func (a LElem2N) ModBitLength() int

func (LElem2N) Modulus

func (a LElem2N) Modulus() *big.Int

func (LElem2N) Mul

func (a LElem2N) Mul(b interface{}) RElem

func (LElem2N) Neg

func (a LElem2N) Neg() RElem

func (LElem2N) NumBytes

func (a LElem2N) NumBytes() uint32

func (LElem2N) One

func (a LElem2N) One() RElem

func (LElem2N) Rand

func (a LElem2N) Rand(prg *frand.RNG) RElem

func (LElem2N) RandBits

func (a LElem2N) RandBits(prg *frand.RNG, nbits int) RElem

func (LElem2N) Sub

func (a LElem2N) Sub(b interface{}) RElem

func (LElem2N) ToBytes

func (a LElem2N) ToBytes(buf []byte)

func (LElem2N) Trunc

func (a LElem2N) Trunc(nBits int) RElem

func (LElem2N) TypeID

func (a LElem2N) TypeID() uint8

func (LElem2N) Uint64

func (a LElem2N) Uint64() uint64

func (LElem2N) Zero

func (a LElem2N) Zero() RElem

type LElem2NBigInt

type LElem2NBigInt struct {
	Val *big.Int
}
var LElem2NBigIntMod LElem2NBigInt // Variable set on the fly
var LElem2NBigIntModHalf LElem2NBigInt // Variable set on the fly
var LElem2NBigIntZero LElem2NBigInt = LElem2NBigInt{big.NewInt(0)}

func (LElem2NBigInt) Add

func (a LElem2NBigInt) Add(b interface{}) RElem

func (LElem2NBigInt) AssertTypeFor

func (a LElem2NBigInt) AssertTypeFor(n RElem) RElem

func (LElem2NBigInt) Copy

func (a LElem2NBigInt) Copy() RElem

func (LElem2NBigInt) Float64

func (a LElem2NBigInt) Float64(fracBits int) float64

func (LElem2NBigInt) FromBigFloat

func (a LElem2NBigInt) FromBigFloat(n *big.Float, fracBits int) RElem

func (LElem2NBigInt) FromBigInt

func (a LElem2NBigInt) FromBigInt(n *big.Int) RElem

func (LElem2NBigInt) FromBytes

func (a LElem2NBigInt) FromBytes(buf []byte) RElem

func (LElem2NBigInt) FromFloat64

func (a LElem2NBigInt) FromFloat64(n float64, fracBits int) RElem

func (LElem2NBigInt) FromInt

func (a LElem2NBigInt) FromInt(n int) RElem

func (LElem2NBigInt) FromUint64

func (a LElem2NBigInt) FromUint64(n uint64) RElem

func (LElem2NBigInt) GetBit

func (a LElem2NBigInt) GetBit(posFromLSB int) uint

func (LElem2NBigInt) Inv

func (a LElem2NBigInt) Inv() RElem

func (LElem2NBigInt) ModBitLength

func (a LElem2NBigInt) ModBitLength() int

func (LElem2NBigInt) Modulus

func (a LElem2NBigInt) Modulus() *big.Int

func (LElem2NBigInt) Mul

func (a LElem2NBigInt) Mul(b interface{}) RElem

func (LElem2NBigInt) Neg

func (a LElem2NBigInt) Neg() RElem

func (LElem2NBigInt) NumBytes

func (a LElem2NBigInt) NumBytes() uint32

func (LElem2NBigInt) One

func (a LElem2NBigInt) One() RElem

func (LElem2NBigInt) Rand

func (a LElem2NBigInt) Rand(prg *frand.RNG) RElem

func (LElem2NBigInt) RandBits

func (a LElem2NBigInt) RandBits(prg *frand.RNG, nbits int) RElem

func (LElem2NBigInt) SetModulusPowerOf2

func (a LElem2NBigInt) SetModulusPowerOf2(k uint)

func (LElem2NBigInt) Sub

func (a LElem2NBigInt) Sub(b interface{}) RElem

func (LElem2NBigInt) ToBigFloat

func (a LElem2NBigInt) ToBigFloat(fracBits int) *big.Float

func (LElem2NBigInt) ToBigInt

func (a LElem2NBigInt) ToBigInt() *big.Int

func (LElem2NBigInt) ToBytes

func (a LElem2NBigInt) ToBytes(buf []byte)

func (LElem2NBigInt) ToSignedBigFloat

func (a LElem2NBigInt) ToSignedBigFloat(fracBits int) *big.Float

func (LElem2NBigInt) ToSignedBigInt

func (a LElem2NBigInt) ToSignedBigInt() *big.Int

func (LElem2NBigInt) Trunc

func (a LElem2NBigInt) Trunc(nBits int) RElem

func (LElem2NBigInt) TypeID

func (a LElem2NBigInt) TypeID() uint8

func (LElem2NBigInt) Uint64

func (a LElem2NBigInt) Uint64() uint64

func (LElem2NBigInt) Zero

func (a LElem2NBigInt) Zero() RElem

type LElemP

type LElemP uint64

Large ring with prime modulus

const LElemPMod LElemP = 2305843009213693951 // 2^61 - 1
const LElemPModHalf LElemP = 1152921504606846976 // 2^60
const LElemPRandBnd LElemP = ^LElemP(0) - ((^LElemP(0)) % LElemPMod)

func (LElemP) Add

func (a LElemP) Add(b interface{}) RElem

func (LElemP) AssertTypeFor

func (a LElemP) AssertTypeFor(n RElem) RElem

func (LElemP) Copy

func (a LElemP) Copy() RElem

func (LElemP) Float64

func (a LElemP) Float64(fracBits int) float64

func (LElemP) FromBigInt

func (a LElemP) FromBigInt(n *big.Int) RElem

func (LElemP) FromBytes

func (a LElemP) FromBytes(buf []byte) RElem

func (LElemP) FromFloat64

func (a LElemP) FromFloat64(n float64, fracBits int) RElem

func (LElemP) FromInt

func (a LElemP) FromInt(n int) RElem

func (LElemP) FromUint64

func (a LElemP) FromUint64(n uint64) RElem

func (LElemP) GetBit

func (a LElemP) GetBit(posFromLSB int) uint

func (LElemP) Inv

func (a LElemP) Inv() RElem

func (LElemP) ModBitLength

func (a LElemP) ModBitLength() int

func (LElemP) Modulus

func (a LElemP) Modulus() *big.Int

func (LElemP) Mul

func (a LElemP) Mul(b interface{}) RElem

Mod64 returns r = u%v.

func (u Uint128) QuoRem64(v uint64) (q Uint128, r uint64) {
	if u.Hi < v {
		q.Lo, r = bits.Div64(u.Hi, u.Lo, v)
	} else {
		q.Hi, r = bits.Div64(0, u.Hi, v)
		q.Lo, r = bits.Div64(r, u.Lo, v)
	}
	return
}

func (LElemP) Neg

func (a LElemP) Neg() RElem

func (LElemP) NumBytes

func (a LElemP) NumBytes() uint32

func (LElemP) One

func (a LElemP) One() RElem

func (LElemP) Rand

func (a LElemP) Rand(prg *frand.RNG) RElem

func (LElemP) RandBits

func (a LElemP) RandBits(prg *frand.RNG, nbits int) RElem

func (LElemP) Sub

func (a LElemP) Sub(b interface{}) RElem

func (LElemP) ToBytes

func (a LElemP) ToBytes(buf []byte)

func (LElemP) Trunc

func (a LElemP) Trunc(nBits int) RElem

func (LElemP) TypeID

func (a LElemP) TypeID() uint8

func (LElemP) Uint64

func (a LElemP) Uint64() uint64

func (LElemP) Zero

func (a LElemP) Zero() RElem

type RElem

type RElem interface {
	Mul(interface{}) RElem
	Add(interface{}) RElem
	Sub(interface{}) RElem
	Neg() RElem
	Inv() RElem
	Zero() RElem
	One() RElem
	Modulus() *big.Int
	Uint64() uint64
	Float64(int) float64
	FromInt(int) RElem
	FromBigInt(*big.Int) RElem
	FromUint64(uint64) RElem
	FromFloat64(float64, int) RElem
	FromBytes([]byte) RElem
	ToBytes([]byte)
	AssertTypeFor(RElem) RElem
	NumBytes() uint32
	Rand(*frand.RNG) RElem
	RandBits(*frand.RNG, int) RElem
	TypeID() uint8
	ModBitLength() int
	GetBit(int) uint
	Trunc(int) RElem
	Copy() RElem
}

type RMat

type RMat []RVec

func FloatToRMat

func FloatToRMat(rtype RElem, a [][]float64, fracBits int) RMat

func InitRMat

func InitRMat(val RElem, nrow, ncol int) RMat

Initalizes a RElemMatrix with nrows = len(RMat) and ncols = len(RMat[0])

func IntToRMat

func IntToRMat(rtype RElem, a [][]int) RMat

func RMultConstMat

func RMultConstMat(c RElem, m RMat) RMat

MultConstMat multiplies c with each element in m (and performs appr modulus)

func RMultElemMat

func RMultElemMat(a, b RMat) RMat

func RMultMat

func RMultMat(a, b RMat) RMat

func (RMat) Add

func (a RMat) Add(b RMat)

func (RMat) AddScalar

func (a RMat) AddScalar(b RElem)

func (RMat) Clear

func (a RMat) Clear()

func (RMat) Copy

func (a RMat) Copy() RMat

func (RMat) Dims

func (a RMat) Dims() (int, int)

func (RMat) MarshalBinary

func (a RMat) MarshalBinary() ([]byte, error)

func (RMat) MulElem

func (a RMat) MulElem(b RMat)

func (RMat) MulScalar

func (a RMat) MulScalar(b RElem)

func (RMat) NumBytes

func (a RMat) NumBytes() uint32

func (RMat) Sub

func (a RMat) Sub(b RMat)

func (RMat) Sum

func (a RMat) Sum(axis int) RVec

axis: 0 (row sum) or 1 (column sum)

func (RMat) ToFloat

func (a RMat) ToFloat(fracBits int) [][]float64

func (RMat) ToInt

func (a RMat) ToInt() [][]int

func (RMat) Transpose

func (a RMat) Transpose() RMat

func (RMat) Trunc

func (a RMat) Trunc(nBits int)

func (RMat) Type

func (a RMat) Type() RElem

func (*RMat) UnmarshalBinary

func (a *RMat) UnmarshalBinary(data []byte) error

type RVec

type RVec []RElem

func FloatToRVec

func FloatToRVec(rtype RElem, a []float64, fracBits int) RVec

func InitRVec

func InitRVec(val RElem, n int) RVec

Initalizes a RElemMatrix of size n RElems

func IntToRVec

func IntToRVec(rtype RElem, a []int) RVec

func RMultConstVec

func RMultConstVec(c RElem, v RVec) RVec

MultConstVec multiplies c with each element in v (and performs appr modulus)

func RMultMatVec

func RMultMatVec(a RMat, b RVec) RVec

func RMultVec

func RMultVec(a, b RVec) RVec

MultVec computes elem-wise product of a and b

func (RVec) Add

func (a RVec) Add(b RVec)

func (RVec) AddScalar

func (a RVec) AddScalar(b RElem)

func (RVec) Clear

func (a RVec) Clear()

func (RVec) Copy

func (a RVec) Copy() RVec

func (RVec) Filter

func (a RVec) Filter(filt []bool) RVec

func (RVec) MarshalBinary

func (a RVec) MarshalBinary() ([]byte, error)

func (RVec) MulElem

func (a RVec) MulElem(b RVec)

func (RVec) MulScalar

func (a RVec) MulScalar(b RElem)

func (RVec) NumBytes

func (a RVec) NumBytes() uint32

func (RVec) Sub

func (a RVec) Sub(b interface{})

func (RVec) ToFloat

func (a RVec) ToFloat(fracBits int) []float64

func (RVec) ToInt

func (a RVec) ToInt() []int

func (RVec) Trunc

func (a RVec) Trunc(nBits int)

func (RVec) Type

func (a RVec) Type() RElem

func (*RVec) UnmarshalBinary

func (a *RVec) UnmarshalBinary(data []byte) error

type SElemC

type SElemC uint8

Small ring used for comparison

const SElemCMod SElemC = 199
const SElemCRandBnd SElemC = ^SElemC(0) - ((^SElemC(0)) % SElemCMod)

func (SElemC) Add

func (a SElemC) Add(b interface{}) RElem

func (SElemC) AssertTypeFor

func (a SElemC) AssertTypeFor(n RElem) RElem

func (SElemC) Copy

func (a SElemC) Copy() RElem

func (SElemC) Float64

func (a SElemC) Float64(fracBits int) float64

func (SElemC) FromBigInt

func (a SElemC) FromBigInt(n *big.Int) RElem

func (SElemC) FromBytes

func (a SElemC) FromBytes(buf []byte) RElem

func (SElemC) FromFloat64

func (a SElemC) FromFloat64(n float64, fracBits int) RElem

func (SElemC) FromInt

func (a SElemC) FromInt(n int) RElem

func (SElemC) FromUint64

func (a SElemC) FromUint64(n uint64) RElem

func (SElemC) GetBit

func (a SElemC) GetBit(posFromLSB int) uint

func (SElemC) Inv

func (a SElemC) Inv() RElem

func (SElemC) ModBitLength

func (a SElemC) ModBitLength() int

func (SElemC) Modulus

func (a SElemC) Modulus() *big.Int

func (SElemC) Mul

func (a SElemC) Mul(b interface{}) RElem

func (SElemC) Neg

func (a SElemC) Neg() RElem

func (SElemC) NumBytes

func (a SElemC) NumBytes() uint32

func (SElemC) One

func (a SElemC) One() RElem

func (SElemC) Rand

func (a SElemC) Rand(prg *frand.RNG) RElem

func (SElemC) RandBits

func (a SElemC) RandBits(prg *frand.RNG, nbits int) RElem

func (SElemC) Sub

func (a SElemC) Sub(b interface{}) RElem

func (SElemC) ToBytes

func (a SElemC) ToBytes(buf []byte)

func (SElemC) Trunc

func (a SElemC) Trunc(nBits int) RElem

func (SElemC) TypeID

func (a SElemC) TypeID() uint8

func (SElemC) Uint64

func (a SElemC) Uint64() uint64

func (SElemC) Zero

func (a SElemC) Zero() RElem

type SElemDS

type SElemDS uint8

Small ring used for division and square root

const SElemDSMod SElemDS = 199
const SElemDSRandBnd SElemDS = ^SElemDS(0) - ((^SElemDS(0)) % SElemDSMod)

func (SElemDS) Add

func (a SElemDS) Add(b interface{}) RElem

func (SElemDS) AssertTypeFor

func (a SElemDS) AssertTypeFor(n RElem) RElem

func (SElemDS) Copy

func (a SElemDS) Copy() RElem

func (SElemDS) Float64

func (a SElemDS) Float64(fracBits int) float64

func (SElemDS) FromBigInt

func (a SElemDS) FromBigInt(n *big.Int) RElem

func (SElemDS) FromBytes

func (a SElemDS) FromBytes(buf []byte) RElem

func (SElemDS) FromFloat64

func (a SElemDS) FromFloat64(n float64, fracBits int) RElem

func (SElemDS) FromInt

func (a SElemDS) FromInt(n int) RElem

func (SElemDS) FromUint64

func (a SElemDS) FromUint64(n uint64) RElem

func (SElemDS) GetBit

func (a SElemDS) GetBit(posFromLSB int) uint

func (SElemDS) Inv

func (a SElemDS) Inv() RElem

func (SElemDS) ModBitLength

func (a SElemDS) ModBitLength() int

func (SElemDS) Modulus

func (a SElemDS) Modulus() *big.Int

func (SElemDS) Mul

func (a SElemDS) Mul(b interface{}) RElem

func (SElemDS) Neg

func (a SElemDS) Neg() RElem

func (SElemDS) NumBytes

func (a SElemDS) NumBytes() uint32

func (SElemDS) One

func (a SElemDS) One() RElem

func (SElemDS) Rand

func (a SElemDS) Rand(prg *frand.RNG) RElem

func (SElemDS) RandBits

func (a SElemDS) RandBits(prg *frand.RNG, nbits int) RElem

func (SElemDS) Sub

func (a SElemDS) Sub(b interface{}) RElem

func (SElemDS) ToBytes

func (a SElemDS) ToBytes(buf []byte)

func (SElemDS) Trunc

func (a SElemDS) Trunc(nBits int) RElem

func (SElemDS) TypeID

func (a SElemDS) TypeID() uint8

func (SElemDS) Uint64

func (a SElemDS) Uint64() uint64

func (SElemDS) Zero

func (a SElemDS) Zero() RElem

type Uint128

type Uint128 struct {
	Hi, Lo uint64
}

Jump to

Keyboard shortcuts

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