Documentation ¶
Overview ¶
Package number implements Rijndael's field (an 8th degree extension of F_2), and Rijndael's ring (a 4th degree ring extension of the field).
Index ¶
- type ArrayRingElem
- func (e ArrayRingElem) Add(f ArrayRingElem) ArrayRingElem
- func (e ArrayRingElem) Dup() ArrayRingElem
- func (e ArrayRingElem) Invert() (ArrayRingElem, bool)
- func (e ArrayRingElem) IsOne() bool
- func (e ArrayRingElem) IsZero() bool
- func (e ArrayRingElem) Mul(f ArrayRingElem) ArrayRingElem
- func (e ArrayRingElem) ScalarMul(g ByteFieldElem) ArrayRingElem
- type ByteFieldElem
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ArrayRingElem ¶
type ArrayRingElem [4]ByteFieldElem
ArrayRingElem is an element of Rijndael's ring, GF(2^8)[x]/(x^4 + 1).
The additive identity is [0 0 0 0] and the multiplicative identity is [1 0 0 0].
func NewArrayRingElem ¶
func NewArrayRingElem() ArrayRingElem
func (ArrayRingElem) Add ¶
func (e ArrayRingElem) Add(f ArrayRingElem) ArrayRingElem
Add returns e + f.
func (ArrayRingElem) Invert ¶
func (e ArrayRingElem) Invert() (ArrayRingElem, bool)
Invert returns an element's multiplicative inverse, if it has one.
func (ArrayRingElem) IsOne ¶
func (e ArrayRingElem) IsOne() bool
IsOne returns whether or not e is one.
func (ArrayRingElem) IsZero ¶
func (e ArrayRingElem) IsZero() bool
IsZero returns whether or not e is zero.
func (ArrayRingElem) Mul ¶
func (e ArrayRingElem) Mul(f ArrayRingElem) ArrayRingElem
Mul returns e * f.
func (ArrayRingElem) ScalarMul ¶
func (e ArrayRingElem) ScalarMul(g ByteFieldElem) ArrayRingElem
ScalarMul multiplies each component of e by a scalar from GF(2^8).
type ByteFieldElem ¶
type ByteFieldElem uint16
ByteFieldElem is an element of Rijndael's field, GF(2^8)--i.e., a byte with field operations.
The two operations implemented are addition and multiplication. The additive identity is 0x00 and all elements have themselves as additive inverses: x.Add(x) = 0x00 always. The multiplicative identity is 0x01 and all non-zero elements have a multiplicative inverse such that x.Mul(x.Invert()) = 0x01.
func (ByteFieldElem) Add ¶
func (e ByteFieldElem) Add(f ByteFieldElem) ByteFieldElem
Add returns e + f.
func (ByteFieldElem) Invert ¶
func (e ByteFieldElem) Invert() ByteFieldElem
Invert returns the multiplicative inverse of e, or 0x00 if e = 0x00.
func (ByteFieldElem) IsOne ¶
func (e ByteFieldElem) IsOne() bool
IsOne returns whether ot not e is one.
func (ByteFieldElem) IsZero ¶
func (e ByteFieldElem) IsZero() bool
IsZero returns whether or not e is zero.
func (ByteFieldElem) Mul ¶
func (e ByteFieldElem) Mul(f ByteFieldElem) (out ByteFieldElem)
Mul returns e * f.