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

pack-priv Class GF2Field

extends Object
Class Inheritance
Imports
org.bouncycastle.util.Pack

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

GF2^8 is implemented using the tower representation: gf4 := gf2[x]/x^2+x+1 gf16 := gf4[y]/y^2+y+x gf256 := gf16[X]/X^2+X+xy

Field Summary

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

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public static short

Returns:

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

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

public static long
addElem_64(long a, long b)

private static short
gf16Mul(short a, short b)

private static short
gf16Mul8(short a)

private static long
gf16Mul8_64(long p)

private static long
gf16Mul_64(long p, long q)

private static short
gf16Squ(short a)

private static long
gf16Squ_64(long p)

private static short
gf256Inv(short a)

private static long
gf256Inv_64(long p)

private static short
gf256Mul(short a, short b)

private static long
gf256Mul_64(long p, long q)

private static short
gf256Squ(short a)

private static long
gf256Squ_64(long p)

private static short
gf4Mul(short a, short b)

private static short
gf4Mul2(short a)

private static long
gf4Mul2_64(long p)

private static short
gf4Mul3(short a)

private static long
gf4Mul_64(long p, long q)

private static short
gf4Squ(short a)

private static long
gf4Squ_64(long p)

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
a
)

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 long
invElem_64(long a)

public static short

Returns:

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

This function multiplies two elements in GF2^8.

public static long
multElem_64(long a, long b)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

gfInvTableback to summary
pack-priv static final byte[] gfInvTable
gfMulTableback to summary
pack-priv static final byte[][] gfMulTable
MASKback to summary
public static final int MASK

Constructor Detail

GF2Fieldback to summary
pack-priv GF2Field()

Method Detail

addElemback to summary
public static short addElem(short a, short b)

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

Parameters
a:short

the first element that is to be added

b:short

the second element that should be added

Returns:short

the sum of the two elements a and b in GF2^8

addElem_64back to summary
public static long addElem_64(long a, long b)
gf16Mulback to summary
private static short gf16Mul(short a, short b)
gf16Mul8back to summary
private static short gf16Mul8(short a)
gf16Mul8_64back to summary
private static long gf16Mul8_64(long p)
gf16Mul_64back to summary
private static long gf16Mul_64(long p, long q)
gf16Squback to summary
private static short gf16Squ(short a)
gf16Squ_64back to summary
private static long gf16Squ_64(long p)
gf256Invback to summary
private static short gf256Inv(short a)
gf256Inv_64back to summary
private static long gf256Inv_64(long p)
gf256Mulback to summary
private static short gf256Mul(short a, short b)
gf256Mul_64back to summary
private static long gf256Mul_64(long p, long q)
gf256Squback to summary
private static short gf256Squ(short a)
gf256Squ_64back to summary
private static long gf256Squ_64(long p)
gf4Mulback to summary
private static short gf4Mul(short a, short b)
gf4Mul2back to summary
private static short gf4Mul2(short a)
gf4Mul2_64back to summary
private static long gf4Mul2_64(long p)
gf4Mul3back to summary
private static short gf4Mul3(short a)
gf4Mul_64back to summary
private static long gf4Mul_64(long p, long q)
gf4Squback to summary
private static short gf4Squ(short a)
gf4Squ_64back to summary
private static long gf4Squ_64(long p)
invElemback to summary
public static short invElem(short a)

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
a: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

invElem_64back to summary
public static long invElem_64(long a)
multElemback to summary
public static short multElem(short a, short b)

This function multiplies two elements in GF2^8. If one of the two elements is 0, 0 is returned.

Parameters
a:short

the first element to be multiplied.

b:short

the second element to be multiplied.

Returns:short

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

multElem_64back to summary
public static long multElem_64(long a, long b)