number

package
v0.0.0-...-2f25eea Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 20, 2016 License: BSD-3-Clause Imports: 0 Imported by: 27

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

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

Add returns e + f.

func (ArrayRingElem) Dup

func (e ArrayRingElem) Dup() ArrayRingElem

Dup returns a duplicate of e.

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

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

Add returns e + f.

func (ByteFieldElem) Dup

func (e ByteFieldElem) Dup() ByteFieldElem

Dup returns a duplicate of e.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL