GF2Field (Bouncy Castle Library 1.52 API Specification)

org.bouncycastle.pqc.crypto.rainbow.util

## Class GF2Field

- java.lang.Object
- - org.bouncycastle.pqc.crypto.rainbow.util.GF2Field

-     public class GF2Field
      extends java.lang.Object

  This class provides the basic operations like addition, multiplication and finding the multiplicative inverse of an element in GF2^8.

  The operations are implemented using the irreducible polynomial 1+x^2+x^3+x^6+x^8 ( 1 0100 1101 = 0x14d )

  This class makes use of lookup tables(exps and logs) for implementing the operations in order to increase the efficiency of Rainbow.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `MASK`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `GF2Field()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static short` | `addElem(short x, short y)` This function calculates the sum of two elements as an operation in GF2^8
    `static short` | `getExp(short x)` This function returns the values of exps-lookup table which correspond to the input
    `static short` | `getLog(short x)` This function returns the values of logs-lookup table which correspond to the input
    `static short` | `invElem(short x)` This function computes the multiplicative inverse of a given element in GF2^8 The 0 has no multiplicative inverse and in this case 0 is returned.
    `static short` | `multElem(short x, short y)` This function multiplies two elements in GF2^8.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### MASK

          public static final int MASK

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### GF2Field

          public GF2Field()

  - ### Method Detail

    - #### addElem

          public static short addElem(short x,
                      short y)

      This function calculates the sum of two elements as an operation in GF2^8
      Parameters:
        `x` - the first element that is to be added
        `y` - the second element that should be add
      Returns:
        the sum of the two elements x and y in GF2^8

    - #### invElem

          public static short invElem(short x)

      This function computes the multiplicative inverse of a given element in GF2^8 The 0 has no multiplicative inverse and in this case 0 is returned.
      Parameters:
        `x` - the element which multiplicative inverse is to be computed
      Returns:
        the multiplicative inverse of the given element, in case it exists or 0, otherwise

    - #### multElem

          public static short multElem(short x,
                       short y)

      This function multiplies two elements in GF2^8. If one of the two elements is 0, 0 is returned.
      Parameters:
        `x` - the first element to be multiplied.
        `y` - the second element to be multiplied.
      Returns:
        the product of the two input elements in GF2^8.

    - #### getExp

          public static short getExp(short x)

      This function returns the values of exps-lookup table which correspond to the input
      Parameters:
        `x` - the index in the lookup table exps
      Returns:
        exps-value, corresponding to the input

    - #### getLog

          public static short getLog(short x)

      This function returns the values of logs-lookup table which correspond to the input
      Parameters:
        `x` - the index in the lookup table logs
      Returns:
        logs-value, corresponding to the input