libffrs.GFi16

class libffrs.GFi16

Finite-field operations for prime fields <= 65537

Methods

GFi16.__init__

Instantiate type for operations over \(GF(65537)\)

GFi16.add

Addition: \(\text{lhs} + \text{rhs}\)

GFi16.div

Division: \(\frac{\text{num}}{\text{den}}\)

GFi16.exp

Exponential function: \(a^{\text{value}}\)

GFi16.inv

Reciprocal: \(\frac{1}{\text{value}}\)

GFi16.log

Logarithm: \(\log_a (\text{value})\)

GFi16.mul

Multiplication: \(\text{lhs} \times \text{rhs}\)

GFi16.pow

Power: \(\text{base}^\text{exponent}\)

GFi16.sub

Subtraction: \(\text{lhs} - \text{rhs}\)

Attributes

GFi16.field_elements

\(p\)

GFi16.power

Always 1

GFi16.prime

\(p\)

GFi16.primitive

Primitive value used to generate the field

__init__(self: libffrs.GFi16, primitive: SupportsInt | SupportsIndex) None

Instantiate type for operations over \(GF(65537)\)

Parameters:

primitive\(a\) – primitive value used to generate the field

add(self: libffrs.GFi16, lhs: SupportsInt | SupportsIndex, rhs: SupportsInt | SupportsIndex) int

Addition: \(\text{lhs} + \text{rhs}\)

div(self: libffrs.GFi16, num: SupportsInt | SupportsIndex, den: SupportsInt | SupportsIndex) int

Division: \(\frac{\text{num}}{\text{den}}\)

exp(self: libffrs.GFi16, value: SupportsInt | SupportsIndex) int

Exponential function: \(a^{\text{value}}\)

inv(self: libffrs.GFi16, value: SupportsInt | SupportsIndex) int

Reciprocal: \(\frac{1}{\text{value}}\)

log(self: libffrs.GFi16, value: SupportsInt | SupportsIndex) int

Logarithm: \(\log_a (\text{value})\)

mul(self: libffrs.GFi16, lhs: SupportsInt | SupportsIndex, rhs: SupportsInt | SupportsIndex) int

Multiplication: \(\text{lhs} \times \text{rhs}\)

pow(self: libffrs.GFi16, base: SupportsInt | SupportsIndex, exponent: SupportsInt | SupportsIndex) int

Power: \(\text{base}^\text{exponent}\)

sub(self: libffrs.GFi16, lhs: SupportsInt | SupportsIndex, rhs: SupportsInt | SupportsIndex) int

Subtraction: \(\text{lhs} - \text{rhs}\)