galoisfield

package
v0.0.0-...-1335e20 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2022 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Element

type Element uint8

func ElementByExponentOfAlpha

func ElementByExponentOfAlpha(exp int) Element

ElementByExponentOfAlpha returns element from exponent n of α^n

func (Element) Add

func (a Element) Add(b Element) Element

Add returns a + b

func (Element) Divide

func (a Element) Divide(b Element) Element

Divide returns a / b

func (Element) Exponent

func (a Element) Exponent() int

Exponent returns exponent n of α^n

func (Element) IsZero

func (a Element) IsZero() bool

IsZero returns true if a is zero value

func (Element) Multiply

func (a Element) Multiply(b Element) Element

Multiply returns a * b

func (Element) Sub

func (a Element) Sub(b Element) Element

Sub returns a - b which is equivalent to Add

type Polynomial

type Polynomial struct {
	// contains filtered or unexported fields
}

Polynomial means polynomial over GF(2^8)

func NewMonomial

func NewMonomial(e Element, degree int) Polynomial

func NewPolynomial

func NewPolynomial(bs *bitset.BitSet) Polynomial

NewPolynomial creates Polynomial from bitset when bitset has n length, polynomial is bitset[0:8]x^n-1 + bitset[8:16]x*n-2 + ... + bitset[8(n-1):8n]

func (Polynomial) Add

func (f Polynomial) Add(g Polynomial) Polynomial

Add returns sum f(x) + g(x)

func (Polynomial) IsZero

func (f Polynomial) IsZero() bool

IsZero returns true if polynomial has no terms

func (Polynomial) Multiply

func (f Polynomial) Multiply(g Polynomial) Polynomial

Add returns product f(x) * g(x)

func (Polynomial) Remainder

func (f Polynomial) Remainder(g Polynomial) Polynomial

Remainder returns remainder of f(x) / g(x)

func (Polynomial) Terms

func (f Polynomial) Terms() []Element

Terms returns terms of polynomial

func (Polynomial) ToByte

func (f Polynomial) ToByte() []byte

ToByte convets polynomial to byte array and sort inversely

Jump to

Keyboard shortcuts

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