Package org.gudy.bouncycastle.math.ec
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 org.gudy.bouncycastle.math.ec.ECFieldElement
ECFieldElement.F2m, ECFieldElement.Fp
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Indicates gaussian normal basis representation (GNB).private int
TPB: The integerk
wherexm + xk + 1
represents the reduction polynomialf(z)
.
PPB: The integerk1
wherexm + xk3 + xk2 + xk1 + 1
represents the reduction polynomialf(z)
.private int
TPB: Always set to0
PPB: The integerk2
wherexm + xk3 + xk2 + xk1 + 1
represents the reduction polynomialf(z)
.private int
TPB: Always set to0
PPB: The integerk3
wherexm + xk3 + xk2 + xk1 + 1
represents the reduction polynomialf(z)
.private int
The exponentm
ofF2m
.static final int
Indicates pentanomial basis representation (PPB).private int
TPB or PPB.private int
The number ofint
s required to holdm
bits.static final int
Indicates trinomial basis representation (TPB).private IntArray
TheIntArray
holding the bits. -
Constructor Summary
ConstructorsModifierConstructorDescriptionF2m
(int m, int k1, int k2, int k3, BigInteger x) Constructor for PPB.private
F2m
(int m, int k, BigInteger x) Constructor for TPB. -
Method Summary
Methods inherited from class org.gudy.bouncycastle.math.ec.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 exponentm
ofF2m
. -
k1
private int k1TPB: The integerk
wherexm + xk + 1
represents the reduction polynomialf(z)
.
PPB: The integerk1
wherexm + xk3 + xk2 + xk1 + 1
represents the reduction polynomialf(z)
. -
k2
private int k2TPB: Always set to0
PPB: The integerk2
wherexm + xk3 + xk2 + xk1 + 1
represents the reduction polynomialf(z)
. -
k3
private int k3TPB: Always set to0
PPB: The integerk3
wherexm + xk3 + xk2 + xk1 + 1
represents the reduction polynomialf(z)
. -
x
TheIntArray
holding the bits. -
t
private int tThe number ofint
s required to holdm
bits.
-
-
Constructor Details
-
F2m
Constructor for PPB.- Parameters:
m
- The exponentm
ofF2m
.k1
- The integerk1
wherexm + xk3 + xk2 + xk1 + 1
represents the reduction polynomialf(z)
.k2
- The integerk2
wherexm + xk3 + xk2 + xk1 + 1
represents the reduction polynomialf(z)
.k3
- The integerk3
wherexm + xk3 + xk2 + xk1 + 1
represents the reduction polynomialf(z)
.x
- The BigInteger representing the value of the field element.
-
F2m
Constructor for TPB.- Parameters:
m
- The exponentm
ofF2m
.k
- The integerk
wherexm + xk + 1
represents the reduction polynomialf(z)
.x
- The BigInteger representing the value of the field element.
-
F2m
-
-
Method Details
-
toBigInteger
- Specified by:
toBigInteger
in classECFieldElement
-
getFieldName
- Specified by:
getFieldName
in classECFieldElement
-
getFieldSize
public int getFieldSize()- Specified by:
getFieldSize
in classECFieldElement
-
checkFieldElements
Checks, if the ECFieldElementsa
andb
are elements of the same fieldF2m
(having the same representation).- Parameters:
a
- field element.b
- field element to be compared.- Throws:
IllegalArgumentException
- ifa
andb
are not elements of the same fieldF2m
(having the same representation).
-
add
- Specified by:
add
in classECFieldElement
-
subtract
- Specified by:
subtract
in classECFieldElement
-
multiply
- Specified by:
multiply
in classECFieldElement
-
divide
- Specified by:
divide
in classECFieldElement
-
negate
- Specified by:
negate
in classECFieldElement
-
square
- Specified by:
square
in classECFieldElement
-
invert
- Specified by:
invert
in classECFieldElement
-
sqrt
- Specified by:
sqrt
in 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
m
of the reduction polynomialf(z)
.
-
getK1
public int getK1()- Returns:
- TPB: The integer
k
wherexm + xk + 1
represents the reduction polynomialf(z)
.
PPB: The integerk1
wherexm + xk3 + xk2 + xk1 + 1
represents the reduction polynomialf(z)
.
-
getK2
public int getK2()- Returns:
- TPB: Always returns
0
PPB: The integerk2
wherexm + xk3 + xk2 + xk1 + 1
represents the reduction polynomialf(z)
.
-
getK3
public int getK3()- Returns:
- TPB: Always set to
0
PPB: The integerk3
wherexm + xk3 + xk2 + xk1 + 1
represents the reduction polynomialf(z)
.
-
equals
-
hashCode
public int hashCode()
-