Documentation
¶
Overview ¶
Package conflux provides set reconciliation core functionality and the supporting math: polynomial arithmetic over finite fields, factoring and rational function interpolation.
Index ¶
- Variables
- func PolyDivmod(x, y *Poly) (q *Poly, r *Poly, err error)
- func Reconcile(values []*Zp, points []*Zp, degDiff int) (*ZSet, *ZSet, error)
- type Bitstring
- func (bs *Bitstring) BitLen() int
- func (bs *Bitstring) ByteLen() int
- func (bs *Bitstring) Bytes() []byte
- func (bs *Bitstring) Clear(bit int)
- func (bs *Bitstring) Flip(bit int)
- func (bs *Bitstring) Get(bit int) int
- func (bs *Bitstring) Lsh(n uint)
- func (bs *Bitstring) Rsh(n uint)
- func (bs *Bitstring) Set(bit int)
- func (bs *Bitstring) SetBytes(buf []byte)
- func (bs *Bitstring) String() string
- type Matrix
- type Poly
- func (p *Poly) Add(x, y *Poly) *Poly
- func (p *Poly) Coeff() []*Zp
- func (p *Poly) Copy() *Poly
- func (p *Poly) Degree() int
- func (p *Poly) Equal(q *Poly) bool
- func (p *Poly) Eval(z *Zp) *Zp
- func (p *Poly) Factor() (*ZSet, error)
- func (p *Poly) IsConstant(c *Zp) bool
- func (p *Poly) Mul(x, y *Poly) *Poly
- func (p *Poly) Neg() *Poly
- func (p *Poly) P() *big.Int
- func (p *Poly) String() string
- func (p *Poly) Sub(x, y *Poly) *Poly
- type RationalFn
- type ZSet
- type Zp
- func (zp *Zp) Add(x, y *Zp) *Zp
- func (zp *Zp) Bytes() []byte
- func (zp *Zp) Cmp(x *Zp) int
- func (zp *Zp) Copy() *Zp
- func (zp *Zp) Div(x, y *Zp) *Zp
- func (zp *Zp) Exp(x, y *Zp) *Zp
- func (zp *Zp) Inv() *Zp
- func (zp *Zp) IsZero() bool
- func (zp *Zp) Mul(x, y *Zp) *Zp
- func (zp *Zp) Neg() *Zp
- func (zp *Zp) Norm() *Zp
- func (zp *Zp) SetBytes(b []byte)
- func (zp *Zp) Sub(x, y *Zp) *Zp
- type ZpSlice
Constants ¶
This section is empty.
Variables ¶
var ErrLowMBar error = errors.New("Low MBar")
var ErrMatrixTooNarrow = errors.New("Matrix is too narrow to reduce")
var ErrPowModSmallN = errors.New("PowMod not implemented for small values of N")
var InterpolationFailure = errors.New("Interpolation failed")
var P_128 = big.NewInt(0).SetBytes([]byte{
0x1, 0x11, 0xd, 0xb2, 0x97, 0xcd, 0x30, 0x8d,
0x90, 0xe5, 0x3f, 0xb8, 0xa1, 0x30, 0x90, 0x97, 0xe9})
P_128 defines a finite field Z(P) that includes all 128-bit integers.
var P_160 = big.NewInt(0).SetBytes([]byte{
0x1, 0xfe, 0x90, 0xe7, 0xb4, 0x19, 0x88, 0xa6,
0x41, 0xb1, 0xa6, 0xfe, 0xc8, 0x7d, 0x89, 0xa3,
0x1e, 0x2a, 0x61, 0x31, 0xf5})
P_160 defines a finite field Z(P) that includes all 160-bit integers.
var P_256 = big.NewInt(0).SetBytes([]byte{
0x1, 0xdd, 0xf4, 0x8a, 0xc3, 0x45, 0x19, 0x18,
0x13, 0xab, 0x7d, 0x92, 0x27, 0x99, 0xe8, 0x93,
0x96, 0x19, 0x43, 0x8, 0xa4, 0xa5, 0x9, 0xb,
0x36, 0xc9, 0x62, 0xd5, 0xd5, 0xd6, 0xdd, 0x80, 0x27})
P_256 defines a finite field Z(P) that includes all 256-bit integers.
var P_512 = big.NewInt(0).SetBytes([]byte{
0x1, 0xc7, 0x19, 0x72, 0x25, 0xf4, 0xa5, 0xd5,
0x8a, 0xc0, 0x2, 0xa4, 0xdc, 0x8d, 0xb1, 0xd9,
0xb0, 0xa1, 0x5b, 0x7a, 0x43, 0x22, 0x5d, 0x5b,
0x51, 0xa8, 0x1c, 0x76, 0x17, 0x44, 0x2a, 0x4a,
0x9c, 0x62, 0xdc, 0x9e, 0x25, 0xd6, 0xe3, 0x12,
0x1a, 0xea, 0xef, 0xac, 0xd9, 0xfd, 0x8d, 0x6c,
0xb7, 0x26, 0x6d, 0x19, 0x15, 0x53, 0xd7, 0xd,
0xb6, 0x68, 0x3b, 0x65, 0x40, 0x89, 0x18, 0x3e, 0xbd})
P_512 defines a finite field Z(P) that includes all 512-bit integers.
var P_SKS *big.Int
P_SKS is the finite field used by SKS, the Synchronizing Key Server.
Functions ¶
func PolyDivmod ¶
PolyDivmod returns the quotient and remainder between two Polys.
Types ¶
type Bitstring ¶
type Bitstring struct {
// contains filtered or unexported fields
}
Bitstring describes a sequence of bits.
func NewBitstring ¶
NewBitstream creates a new zeroed Bitstring of the specified number of bits.
func NewZpBitstring ¶
NewZpBitstring creates a new Bitstring from a Zp integer over a finite field.
func (*Bitstring) Get ¶
Get returns the bit value at the given position. If the bit position is greater than the Bitstring size, or less than zero, Get panics.
type Matrix ¶
type Matrix struct {
// contains filtered or unexported fields
}
Matrix represents a rectangular array of numbers over a finite field Z(p).
type Poly ¶
type Poly struct {
// contains filtered or unexported fields
}
Poly represents a polynomial in a finite field.
func NewPoly ¶
NewPoly creates a polynomial with the given coefficients, in ascending degree order.
For example, NewPoly(1,-2,3) represents the polynomial 3x^2 - 2x + 1.
func PolyRand ¶
PolyRand generates a random polynomial of degree n. This is useful for probabilistic polynomial factoring.
func (*Poly) Coeff ¶
Coeff returns the coefficients for each term of the polynomial. Coefficients are represented as integers in a finite field Zp.
func (*Poly) Degree ¶
Degree returns the highest exponent that appears in the polynomial. For example, the degree of (x^2 + 1) is 2, the degree of (x^1) is 1.
func (*Poly) Factor ¶
Factor reduces a polynomial to irreducible linear components. If the polynomial is not reducible to a product of linears, the polynomial is useless for reconciliation, resulting in an error. Returns a ZSet of all the constants in each linear factor.
func (*Poly) IsConstant ¶
IsConstant returns whether the Poly is just a constant value.
func (*Poly) P ¶
P returns the integer P defining the finite field of the polynomial's coefficients.
type RationalFn ¶
RationalFn describes a function that is the ratio between two polynomials.
func Interpolate ¶
func Interpolate(values []*Zp, points []*Zp, degDiff int) (rfn *RationalFn, err error)
Interpolate returns the ratio of two polynomials RationalFn, given a set of sample points and output values. The coefficients of the resulting numerator and denominator represent the disjoint members in two sets being reconciled.
type ZSet ¶
type ZSet struct {
// contains filtered or unexported fields
}
ZSet is a set of integers in a finite field.
func ZSetDiff ¶
ZSetDiff returns the set difference between two ZSets: the set of all Z(p) in a that are not in b.
type Zp ¶
type Zp struct { // Int is the integer's value. *big.Int // P is the prime bound of the finite field Z(p). P *big.Int }
Zp represents a value in the finite field Z(p), an integer in which all arithmetic is (mod p).
Directories
¶
Path | Synopsis |
---|---|
cmd
|
|
primegen
primegen is a utility for generating large primes that bound a given bit length.
|
primegen is a utility for generating large primes that bound a given bit length. |
sks-dump-ptree
sks-dump-ptree is a debugging utility developed to parse and reverse engineer the SKS PTree databases.
|
sks-dump-ptree is a debugging utility developed to parse and reverse engineer the SKS PTree databases. |
Package recon provides the SKS reconciliation protocol, prefix tree interface and an in-memory prefix-tree implementation.
|
Package recon provides the SKS reconciliation protocol, prefix tree interface and an in-memory prefix-tree implementation. |
leveldb
Package leveldb provides a key-value storage implementation of the recon prefix tree interface.
|
Package leveldb provides a key-value storage implementation of the recon prefix tree interface. |
Package testing provides some unit-testing support functions.
|
Package testing provides some unit-testing support functions. |