Top Description Fields Constructors Methods
org.bouncycastle.pqc.legacy.crypto.rainbow.util

public Class GF2Field

extends Object
Class Inheritance

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

Modifier and TypeField and Description
pack-priv static final short[]
pack-priv static final short[]
public static final int

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static short

Returns:

the sum of the two elements x and y in GF2^8
addElem
(short
the first element that is to be added
x
,
short
the second element that should be add
y
)

This function calculates the sum of two elements as an operation in GF2^8

public static short

Returns:

exps-value, corresponding to the input
getExp
(short
the index in the lookup table exps
x
)

This function returns the values of exps-lookup table which correspond to the input

public static short

Returns:

logs-value, corresponding to the input
getLog
(short
the index in the lookup table logs
x
)

This function returns the values of logs-lookup table which correspond to the input

public static short

Returns:

the multiplicative inverse of the given element, in case it exists or 0, otherwise
invElem
(short
the element which multiplicative inverse is to be computed
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.

public static short

Returns:

the product of the two input elements in GF2^8.
multElem
(short
the first element to be multiplied.
x
,
short
the second element to be multiplied.
y
)

This function multiplies two elements in GF2^8.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

expsback to summary
pack-priv static final short[] exps
logsback to summary
pack-priv static final short[] logs
MASKback to summary
public static final int MASK

Constructor Detail

GF2Fieldback to summary
public GF2Field()

Method Detail

addElemback to summary
public static short addElem(short x, short y)

This function calculates the sum of two elements as an operation in GF2^8

Parameters
x:short

the first element that is to be added

y:short

the second element that should be add

Returns:short

the sum of the two elements x and y in GF2^8

getExpback to summary
public static short getExp(short x)

This function returns the values of exps-lookup table which correspond to the input

Parameters
x:short

the index in the lookup table exps

Returns:short

exps-value, corresponding to the input

getLogback to summary
public static short getLog(short x)

This function returns the values of logs-lookup table which correspond to the input

Parameters
x:short

the index in the lookup table logs

Returns:short

logs-value, corresponding to the input

invElemback to summary
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:short

the element which multiplicative inverse is to be computed

Returns:short

the multiplicative inverse of the given element, in case it exists or 0, otherwise

multElemback to summary
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:short

the first element to be multiplied.

y:short

the second element to be multiplied.

Returns:short

the product of the two input elements in GF2^8.