Bouncy Castle Cryptography 1.48

org.bouncycastle.pqc.math.linearalgebra
Interface GFElement

All Known Implementing Classes:
GF2nElement, GF2nONBElement, GF2nPolynomialElement

public interface GFElement

This interface defines a finite field element. It is implemented by the classes GFPElement and GF2nElement.

See Also:
GFPElement, GF2nElement

Method Summary
 GFElement add(GFElement addend)
          Compute the sum of this element and the addend.
 void addToThis(GFElement addend)
          Compute the sum of this element and the addend, overwriting this element.
 java.lang.Object clone()
           
 boolean equals(java.lang.Object other)
          Compare this curve with another object.
 int hashCode()
           
 GFElement invert()
          Compute the multiplicative inverse of this element.
 boolean isOne()
          Checks whether this element is one.
 boolean isZero()
          Checks whether this element is zero.
 GFElement multiply(GFElement factor)
          Compute the product of this element and factor.
 void multiplyThisBy(GFElement factor)
          Compute this * factor (overwrite this).
 GFElement subtract(GFElement minuend)
          Compute the difference of this element and minuend.
 void subtractFromThis(GFElement minuend)
          Compute the difference of this element and minuend, overwriting this element.
 byte[] toByteArray()
          Returns this element as byte array.
 java.math.BigInteger toFlexiBigInt()
          Returns this element as FlexiBigInt.
 java.lang.String toString()
          Return a String representation of this element.
 java.lang.String toString(int radix)
          Return a String representation of this element.
 

Method Detail

clone

java.lang.Object clone()
Returns:
a copy of this GFElement

equals

boolean equals(java.lang.Object other)
Compare this curve with another object.

Overrides:
equals in class java.lang.Object
Parameters:
other - the other object
Returns:
the result of the comparison

hashCode

int hashCode()
Overrides:
hashCode in class java.lang.Object
Returns:
the hash code of this element

isZero

boolean isZero()
Checks whether this element is zero.

Returns:
true if this is the zero element

isOne

boolean isOne()
Checks whether this element is one.

Returns:
true if this is the one element

add

GFElement add(GFElement addend)
              throws java.lang.RuntimeException
Compute the sum of this element and the addend.

Parameters:
addend - the addend
Returns:
this + other (newly created)
Throws:
DifferentFieldsException - if the elements are of different fields.
java.lang.RuntimeException

addToThis

void addToThis(GFElement addend)
               throws java.lang.RuntimeException
Compute the sum of this element and the addend, overwriting this element.

Parameters:
addend - the addend
Throws:
DifferentFieldsException - if the elements are of different fields.
java.lang.RuntimeException

subtract

GFElement subtract(GFElement minuend)
                   throws java.lang.RuntimeException
Compute the difference of this element and minuend.

Parameters:
minuend - the minuend
Returns:
this - minuend (newly created)
Throws:
DifferentFieldsException - if the elements are of different fields.
java.lang.RuntimeException

subtractFromThis

void subtractFromThis(GFElement minuend)
Compute the difference of this element and minuend, overwriting this element.

Parameters:
minuend - the minuend
Throws:
DifferentFieldsException - if the elements are of different fields.

multiply

GFElement multiply(GFElement factor)
                   throws java.lang.RuntimeException
Compute the product of this element and factor.

Parameters:
factor - the factor
Returns:
this * factor (newly created)
Throws:
DifferentFieldsException - if the elements are of different fields.
java.lang.RuntimeException

multiplyThisBy

void multiplyThisBy(GFElement factor)
                    throws java.lang.RuntimeException
Compute this * factor (overwrite this).

Parameters:
factor - the factor
Throws:
DifferentFieldsException - if the elements are of different fields.
java.lang.RuntimeException

invert

GFElement invert()
                 throws java.lang.ArithmeticException
Compute the multiplicative inverse of this element.

Returns:
this-1 (newly created)
Throws:
java.lang.ArithmeticException - if this is the zero element.

toFlexiBigInt

java.math.BigInteger toFlexiBigInt()
Returns this element as FlexiBigInt. The conversion is P1363-conform.

Returns:
this element as BigInt

toByteArray

byte[] toByteArray()
Returns this element as byte array. The conversion is P1363-conform.

Returns:
this element as byte array

toString

java.lang.String toString()
Return a String representation of this element.

Overrides:
toString in class java.lang.Object
Returns:
String representation of this element

toString

java.lang.String toString(int radix)
Return a String representation of this element. radix specifies the radix of the String representation.

Parameters:
radix - specifies the radix of the String representation
Returns:
String representation of this element with the specified radix

Bouncy Castle Cryptography 1.48