Documentation
¶
Overview ¶
Package gf256 represents elements in the Galois Field GF(2^8)
Index ¶
- Constants
- func Add(a, b uint8) uint8
- func Divide(a, b uint8) uint8
- func GenerateInverseTable() [256]uint8
- func GenerateMultiplicationTable() [256][256]uint8
- func InterpolatePolynomial(xSamples, ySamples []uint8, x uint8) uint8
- func Inverse(a uint8) uint8
- func InverseDo(a uint8) uint8
- func Multiply(a, b uint8) uint8
- func MultiplyDo(a, b uint8) uint8
- func PolynomialEvaluate(coefficients PolynomialCoefficients, x uint8) uint8
- func Subtract(a, b uint8) uint8
- type PolynomialCoefficients
Constants ¶
const IrreduciblePolynomial uint8 = 0x1B
IrreduciblePolynomial use the irreducible polynomial x^8 + x^4 + x^3 + x + 1 (0x11B in hex)
Variables ¶
This section is empty.
Functions ¶
func GenerateInverseTable ¶
func GenerateInverseTable() [256]uint8
GenerateInverseTable creates a 256-element lookup table for multiplicative inverses
func GenerateMultiplicationTable ¶
func GenerateMultiplicationTable() [256][256]uint8
GenerateMultiplicationTable creates a 256x256 lookup table for multiplication
func InterpolatePolynomial ¶
InterpolatePolynomial takes N sample points and returns the value at a given x using a lagrange interpolation.
func Inverse ¶
Inverse returns multiplicative inverse in GF(2^8) using the Extended Euclidean Algorithm
func InverseDo ¶
InverseDo calculates the multiplicative inverse in GF(2^8) using the Extended Euclidean Algorithm
func MultiplyDo ¶
func PolynomialEvaluate ¶
func PolynomialEvaluate(coefficients PolynomialCoefficients, x uint8) uint8
PolynomialEvaluate returns the value of the polynomial for the given x using Horner's method for efficient computation.