Documentation ¶
Index ¶
- Variables
- func AddVectors(vs ...[]*big.Int) []*big.Int
- func Coefficients(S []*big.Int) []*big.Int
- func InField(x *big.Int) bool
- func IsRoot(m *big.Int, a []*big.Int) bool
- func SRMix(m *big.Int, pads []*big.Int) []*big.Int
- func SRMixPads(kp [][]byte, my int) []*big.Int
- func SharedKeys(secrets []*x25519.KX, publics []*x25519.Public, sid []byte, ...) (sr [][][]byte, dc [][]*Vec)
- type Vec
Constants ¶
This section is empty.
Variables ¶
var F *big.Int
F is the field prime 2**127 - 1.
Functions ¶
func AddVectors ¶
AddVectors sums each vector element over F, returning a new vector. When peers are honest (DC-mix pads sum to zero) this creates the unpadded vector of message power sums.
func Coefficients ¶
Coefficients calculates a{0}..a{n} for the polynomial:
g(x) = a{0} + a{1}x + a{2}x**2 + ... + a{n-1}x**(n-1) + a{n}x**n (mod F)
where
a{n} = -1 a{n-1} = -(1/1) * a{n}*S{0} a{n-2} = -(1/2) * (a{n-1}*S{0} + a{n}*S{1}) a{n-3} = -(1/3) * (a{n-2}*S{0} + a{n-1}*S{1} + a{n}*S{2}) ...
The roots of this polynomial are the set of recovered messages.
Note that the returned slice of coefficients is one element larger than the slice of partial sums.
func IsRoot ¶
IsRoot checks that the message m is a root of the polynomial with coefficients a (mod F) without solving for every root.
func SRMix ¶
SRMix creates the padded {m**1, m**2, ..., m**n} message exponentials vector. Message must be bounded by the field prime and must be unique to every exponential SR run in a mix session to ensure anonymity.
func SRMixPads ¶
SRMixPads creates a vector of exponential DC-net pads from a vector of shared secrets with each participating peer in the DC-net.
func SharedKeys ¶
func SharedKeys(secrets []*x25519.KX, publics []*x25519.Public, sid []byte, msize, run, start, mcount int) (sr [][][]byte, dc [][]*Vec)
SharedKeys creates the SR and DC shared secret keys for mcount mixes, where indexes [start, start+mcount) are a peer's pre-assigned non-anonymous positions.
Types ¶
type Vec ¶
Vec is a N-element vector of Msize []byte messages.
func DCMix ¶
DCMix creates the DC-net vector of message m xor'd into m's reserved anonymous slot position of the pads DC-net pads. Panics if len(m) is not the vector's message size.
func DCMixPads ¶
DCMixPads creates the vector of DC-net pads from shared secrets with each mix participant.
func XorVectors ¶
XorVectors calculates the xor of all vectors. Panics if vectors do not share identical dimensions.