Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Add ¶
Add combines two numbers in GF(2^8)
GF(2^8) addition and subtraction are performed by the exclusive or operation. The two operations are the same; there is no difference between addition and subtraction.
func Div ¶
Div divides two numbers in GF(2^8)
GF(2^8) division can be done quickly with a 256-byte log and exponentiation tables. To divide `a` by `b` using the tables: - Look up `a` on the log table. - Look up `b` on the log table. - Subtract `b`s table value from `a`s mod 255. (normal, not GF(2^8) subtraction) - Look up the difference on the exp table, this is the GF(2^8) quotient.
func InterpolatePolynomial ¶
InterpolatePolynomial takes N sample points and returns the value at a given x using a lagrange interpolation.
func Mult ¶
Mult multiplies two numbers in GF(2^8)
GF(2^8) multiplication can be done quickly with a 256-byte log and exponentiation tables. To multiply `a` by `b` using the tables: - Look up `a` on the log table. - Look up `b` on the log table. - Add up the two table values (using normal, not GF(2^8), addition) mod 255 - Look up the sum on the exponentiation table, this is the GF(2^8) product.
Types ¶
type Polynomial ¶
type Polynomial struct {
// contains filtered or unexported fields
}
Polynomial represents a polynomial of arbitrary degree
func MakePolynomial ¶
func MakePolynomial(intercept, degree uint8) Polynomial
MakePolynomial constructs a random polynomial of the given degree but with the provided intercept value.
func (*Polynomial) Evaluate ¶
func (p *Polynomial) Evaluate(x uint8) uint8
Evaluate returns the value of the polynomial for the given x