org.testifyproject.bouncycastle.pqc.math.linearalgebra.GFElement Maven / Gradle / Ivy
The newest version!
package org.testifyproject.bouncycastle.pqc.math.linearalgebra;
import java.math.BigInteger;
/**
* This interface defines a finite field element. It is implemented by the
* classes {@link GFPElement} and {@link GF2nElement}.
*
* @see GFPElement
* @see GF2nElement
*/
public interface GFElement
{
/**
* @return a copy of this GFElement
*/
Object clone();
// /////////////////////////////////////////////////////////////////
// org.testifyproject.testifyprojectparison
// /////////////////////////////////////////////////////////////////
/**
* Compare this curve with another object.
*
* @param other the other object
* @return the result of the org.testifyproject.testifyprojectparison
*/
boolean equals(Object other);
/**
* @return the hash code of this element
*/
int hashCode();
/**
* Checks whether this element is zero.
*
* @return true if this is the zero element
*/
boolean isZero();
/**
* Checks whether this element is one.
*
* @return true if this is the one element
*/
boolean isOne();
// /////////////////////////////////////////////////////////////////////
// arithmetic
// /////////////////////////////////////////////////////////////////////
/**
* Compute the sum of this element and the addend.
*
* @param addend the addend
* @return this + other (newly created)
* @throws DifferentFieldsException if the elements are of different fields.
*/
GFElement add(GFElement addend)
throws RuntimeException;
/**
* Compute the sum of this element and the addend, overwriting this element.
*
* @param addend the addend
* @throws DifferentFieldsException if the elements are of different fields.
*/
void addToThis(GFElement addend)
throws RuntimeException;
/**
* Compute the difference of this element and minuend.
*
* @param minuend the minuend
* @return this - minuend (newly created)
* @throws DifferentFieldsException if the elements are of different fields.
*/
GFElement subtract(GFElement minuend)
throws RuntimeException;
/**
* Compute the difference of this element and minuend,
* overwriting this element.
*
* @param minuend the minuend
* @throws DifferentFieldsException if the elements are of different fields.
*/
void subtractFromThis(GFElement minuend);
/**
* Compute the product of this element and factor.
*
* @param factor the factor
* @return this * factor (newly created)
* @throws DifferentFieldsException if the elements are of different fields.
*/
GFElement multiply(GFElement factor)
throws RuntimeException;
/**
* Compute this * factor (overwrite this).
*
* @param factor the factor
* @throws DifferentFieldsException if the elements are of different fields.
*/
void multiplyThisBy(GFElement factor)
throws RuntimeException;
/**
* Compute the multiplicative inverse of this element.
*
* @return this-1 (newly created)
* @throws ArithmeticException if this is the zero element.
*/
GFElement invert()
throws ArithmeticException;
// /////////////////////////////////////////////////////////////////////
// conversion
// /////////////////////////////////////////////////////////////////////
/**
* Returns this element as FlexiBigInt. The conversion is P1363-conform.
*
* @return this element as BigInt
*/
BigInteger toFlexiBigInt();
/**
* Returns this element as byte array. The conversion is P1363-conform.
*
* @return this element as byte array
*/
byte[] toByteArray();
/**
* Return a String representation of this element.
*
* @return String representation of this element
*/
String toString();
/**
* Return a String representation of this element. radix
* specifies the radix of the String representation.
*
* @param radix specifies the radix of the String representation
* @return String representation of this element with the specified radix
*/
String toString(int radix);
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy