Class ECFieldElement.F2m
java.lang.Object
org.gudy.bouncycastle.math.ec.ECFieldElement
org.gudy.bouncycastle.math.ec.ECFieldElement.F2m
- All Implemented Interfaces:
ECConstants
- Enclosing class:
ECFieldElement
Class representing the Elements of the finite field
F2m in polynomial basis (PB)
representation. Both trinomial (TPB) and pentanomial (PPB) polynomial
basis representations are supported. Gaussian normal basis (GNB)
representation is not supported.-
Nested Class Summary
Nested classes/interfaces inherited from class ECFieldElement
ECFieldElement.F2m, ECFieldElement.Fp -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intIndicates gaussian normal basis representation (GNB).private intTPB: The integerkwherexm + xk + 1represents the reduction polynomialf(z).
PPB: The integerk1wherexm + xk3 + xk2 + xk1 + 1represents the reduction polynomialf(z).private intTPB: Always set to0
PPB: The integerk2wherexm + xk3 + xk2 + xk1 + 1represents the reduction polynomialf(z).private intTPB: Always set to0
PPB: The integerk3wherexm + xk3 + xk2 + xk1 + 1represents the reduction polynomialf(z).private intThe exponentmofF2m.static final intIndicates pentanomial basis representation (PPB).private intTPB or PPB.private intThe number ofints required to holdmbits.static final intIndicates trinomial basis representation (TPB).private IntArrayTheIntArrayholding the bits. -
Constructor Summary
ConstructorsModifierConstructorDescriptionF2m(int m, int k1, int k2, int k3, BigInteger x) Constructor for PPB.privateF2m(int m, int k, BigInteger x) Constructor for TPB. -
Method Summary
Methods inherited from class ECFieldElement
toString
-
Field Details
-
GNB
public static final int GNBIndicates gaussian normal basis representation (GNB). Number chosen according to X9.62. GNB is not implemented at present.- See Also:
-
TPB
public static final int TPBIndicates trinomial basis representation (TPB). Number chosen according to X9.62.- See Also:
-
PPB
public static final int PPBIndicates pentanomial basis representation (PPB). Number chosen according to X9.62.- See Also:
-
representation
private int representationTPB or PPB. -
m
private int mThe exponentmofF2m. -
k1
private int k1TPB: The integerkwherexm + xk + 1represents the reduction polynomialf(z).
PPB: The integerk1wherexm + xk3 + xk2 + xk1 + 1represents the reduction polynomialf(z). -
k2
private int k2TPB: Always set to0
PPB: The integerk2wherexm + xk3 + xk2 + xk1 + 1represents the reduction polynomialf(z). -
k3
private int k3TPB: Always set to0
PPB: The integerk3wherexm + xk3 + xk2 + xk1 + 1represents the reduction polynomialf(z). -
x
TheIntArrayholding the bits. -
t
private int tThe number ofints required to holdmbits.
-
-
Constructor Details
-
F2m
Constructor for PPB.- Parameters:
m- The exponentmofF2m.k1- The integerk1wherexm + xk3 + xk2 + xk1 + 1represents the reduction polynomialf(z).k2- The integerk2wherexm + xk3 + xk2 + xk1 + 1represents the reduction polynomialf(z).k3- The integerk3wherexm + xk3 + xk2 + xk1 + 1represents the reduction polynomialf(z).x- The BigInteger representing the value of the field element.
-
F2m
Constructor for TPB.- Parameters:
m- The exponentmofF2m.k- The integerkwherexm + xk + 1represents the reduction polynomialf(z).x- The BigInteger representing the value of the field element.
-
F2m
-
-
Method Details
-
toBigInteger
- Specified by:
toBigIntegerin classECFieldElement
-
getFieldName
- Specified by:
getFieldNamein classECFieldElement
-
getFieldSize
public int getFieldSize()- Specified by:
getFieldSizein classECFieldElement
-
checkFieldElements
Checks, if the ECFieldElementsaandbare elements of the same fieldF2m(having the same representation).- Parameters:
a- field element.b- field element to be compared.- Throws:
IllegalArgumentException- ifaandbare not elements of the same fieldF2m(having the same representation).
-
add
- Specified by:
addin classECFieldElement
-
subtract
- Specified by:
subtractin classECFieldElement
-
multiply
- Specified by:
multiplyin classECFieldElement
-
divide
- Specified by:
dividein classECFieldElement
-
negate
- Specified by:
negatein classECFieldElement
-
square
- Specified by:
squarein classECFieldElement
-
invert
- Specified by:
invertin classECFieldElement
-
sqrt
- Specified by:
sqrtin classECFieldElement
-
getRepresentation
public int getRepresentation()- Returns:
- the representation of the field
F2m, either of TPB (trinomial basis representation) or PPB (pentanomial basis representation).
-
getM
public int getM()- Returns:
- the degree
mof the reduction polynomialf(z).
-
getK1
public int getK1()- Returns:
- TPB: The integer
kwherexm + xk + 1represents the reduction polynomialf(z).
PPB: The integerk1wherexm + xk3 + xk2 + xk1 + 1represents the reduction polynomialf(z).
-
getK2
public int getK2()- Returns:
- TPB: Always returns
0
PPB: The integerk2wherexm + xk3 + xk2 + xk1 + 1represents the reduction polynomialf(z).
-
getK3
public int getK3()- Returns:
- TPB: Always set to
0
PPB: The integerk3wherexm + xk3 + xk2 + xk1 + 1represents the reduction polynomialf(z).
-
equals
-
hashCode
-