IAIK ECC
version 2.18

iaik.security.ecc.math.field
Interface Field

All Known Subinterfaces:
BinaryField, PrimeField

public interface Field

Abstract representation of a finite field (e.g. prime field, or binary field). Every implementation must implement this interface and use the FieldFactory to get an instance.

This interface defines the following field operations:

  • add performs the add "+" field operation.
  • negate calculates the additive inverse element.
  • multiply performs the multiply "*" field operation.
  • invert calculates the multiplicative inverse element.
  • square additional the square operation is defined. Since there exist very efficient squaring algorithms (especially over fields with char. 2) this method has been added.

    To perform the field operation, create the required field elements (use the newElement methods) and use their arithmetic methods.

    !! ATTENTION !! DON'T MIX UP DIFFERENT FIELDS

    For performance reasons some implementations may omit type checking, and since all fields are derived from the same base class (and so are the values) this may result in class cast exceptions.

    See Also:
    FieldFactory

    Method Summary
     void add(FieldElement a, FieldElement b)
              Computes a += b ATTENTION: you mustn't provide elements of different fields.
     FieldFactory getFieldFactory()
               
     int getFieldId()
              The type of the field (prime or binary)
     FieldElement getONEelement()
              Get the ONE (multiplicative neutral) element of this field.
     java.math.BigInteger getSize()
               
     FieldElement getZEROelement()
              Get the ZERO (additive neutral) element of this field.
     void invert(FieldElement a)
              Calculates the multiplicative inverse.
     void multiply(FieldElement a, FieldElement b)
              Computes a *= b; ATTENTION: you mustn't provide elements of different fields.
     void negate(FieldElement a)
              Negates a field element (additive inverse operation).
     FieldElement newElement(byte[] b)
              Creates a new field element performing the octet string to field element conversation primitive as described in P1363 and X9.62
     void square(FieldElement a)
              Squares the specified field element.
     iaik.asn1.ASN1Object toASN1Object()
               
     

    Method Detail

    add

    public void add(FieldElement a,
                    FieldElement b)
    Computes a += b ATTENTION: you mustn't provide elements of different fields.

    Parameters:
    a - the first addend and result.
    b - the second addend.

    getFieldFactory

    public FieldFactory getFieldFactory()
    Returns:
    the factory for the field implementation.

    getFieldId

    public int getFieldId()
    The type of the field (prime or binary)

    Returns:
    the id of the field.
    See Also:
    BinaryField.BINARY_FIELD_ID, PrimeField.PRIME_FIELD_ID

    getONEelement

    public FieldElement getONEelement()
    Get the ONE (multiplicative neutral) element of this field.

    Returns:
    ONE

    getSize

    public java.math.BigInteger getSize()
    Returns:
    the size of the underlying field.

    getZEROelement

    public FieldElement getZEROelement()
    Get the ZERO (additive neutral) element of this field.

    Returns:
    ZERO

    invert

    public void invert(FieldElement a)
    Calculates the multiplicative inverse. ATTENTION: you must provide a field element of the correct field.

    Parameters:
    a - the field element to be inverted.

    multiply

    public void multiply(FieldElement a,
                         FieldElement b)
    Computes a *= b; ATTENTION: you mustn't provide elements of different fields.

    Parameters:
    a - the multiplicand and result
    b - the multiplier.

    negate

    public void negate(FieldElement a)
    Negates a field element (additive inverse operation). ATTENTION: you must provide a field element of the correct field.

    Parameters:
    a - the field element to be negated.

    newElement

    public FieldElement newElement(byte[] b)
    Creates a new field element performing the octet string to field element conversation primitive as described in P1363 and X9.62

    Returns:
    the new generated FieldElement

    square

    public void square(FieldElement a)
    Squares the specified field element. Since this method may have efficient implementations (especially over binary fields) it is defined here. ATTENTION: you must provide a field element of the expected field.

    Parameters:
    a - the field element to be squared.

    toASN1Object

    public iaik.asn1.ASN1Object toASN1Object()
    Returns:
    an ASN.1 representation of this finite field.

    IAIK ECC
    version 2.18

    IAIK-ECC 2.18, (c) 2002 IAIK, (c) 2003 SIC