Package org.bouncycastle.math.ec
Class ECFieldElement.F2m
- java.lang.Object
-
- org.bouncycastle.math.ec.ECFieldElement
-
- org.bouncycastle.math.ec.ECFieldElement.F2m
-
- All Implemented Interfaces:
ECConstants
- Enclosing class:
- ECFieldElement
public static class ECFieldElement.F2m extends ECFieldElement
Class representing the Elements of the finite fieldF2min 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.bouncycastle.math.ec.ECFieldElement
ECFieldElement.F2m, ECFieldElement.Fp
-
-
Constructor Summary
Constructors Constructor Description F2m(int m, int k1, int k2, int k3, BigInteger x)Deprecated.Use ECCurve.fromBigInteger to construct field elementsF2m(int m, int k, BigInteger x)Deprecated.Use ECCurve.fromBigInteger to construct field elements
-
Method Summary
-
Methods inherited from class org.bouncycastle.math.ec.ECFieldElement
getEncoded, toString
-
-
-
-
Field Detail
-
GNB
public static final int GNB
Indicates gaussian normal basis representation (GNB). Number chosen according to X9.62. GNB is not implemented at present.- See Also:
- Constant Field Values
-
TPB
public static final int TPB
Indicates trinomial basis representation (TPB). Number chosen according to X9.62.- See Also:
- Constant Field Values
-
PPB
public static final int PPB
Indicates pentanomial basis representation (PPB). Number chosen according to X9.62.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
F2m
public F2m(int m, int k1, int k2, int k3, BigInteger x)Deprecated.Use ECCurve.fromBigInteger to construct field elementsConstructor 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
public F2m(int m, int k, BigInteger x)Deprecated.Use ECCurve.fromBigInteger to construct field elementsConstructor 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.
-
-
Method Detail
-
bitLength
public int bitLength()
- Overrides:
bitLengthin classECFieldElement
-
isOne
public boolean isOne()
- Overrides:
isOnein classECFieldElement
-
isZero
public boolean isZero()
- Overrides:
isZeroin classECFieldElement
-
testBitZero
public boolean testBitZero()
- Overrides:
testBitZeroin classECFieldElement
-
toBigInteger
public BigInteger toBigInteger()
- Specified by:
toBigIntegerin classECFieldElement
-
getFieldName
public String getFieldName()
- Specified by:
getFieldNamein classECFieldElement
-
getFieldSize
public int getFieldSize()
- Specified by:
getFieldSizein classECFieldElement
-
checkFieldElements
public static void checkFieldElements(ECFieldElement a, ECFieldElement b)
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
public ECFieldElement add(ECFieldElement b)
- Specified by:
addin classECFieldElement
-
addOne
public ECFieldElement addOne()
- Specified by:
addOnein classECFieldElement
-
subtract
public ECFieldElement subtract(ECFieldElement b)
- Specified by:
subtractin classECFieldElement
-
multiply
public ECFieldElement multiply(ECFieldElement b)
- Specified by:
multiplyin classECFieldElement
-
multiplyMinusProduct
public ECFieldElement multiplyMinusProduct(ECFieldElement b, ECFieldElement x, ECFieldElement y)
- Overrides:
multiplyMinusProductin classECFieldElement
-
multiplyPlusProduct
public ECFieldElement multiplyPlusProduct(ECFieldElement b, ECFieldElement x, ECFieldElement y)
- Overrides:
multiplyPlusProductin classECFieldElement
-
divide
public ECFieldElement divide(ECFieldElement b)
- Specified by:
dividein classECFieldElement
-
negate
public ECFieldElement negate()
- Specified by:
negatein classECFieldElement
-
square
public ECFieldElement square()
- Specified by:
squarein classECFieldElement
-
squareMinusProduct
public ECFieldElement squareMinusProduct(ECFieldElement x, ECFieldElement y)
- Overrides:
squareMinusProductin classECFieldElement
-
squarePlusProduct
public ECFieldElement squarePlusProduct(ECFieldElement x, ECFieldElement y)
- Overrides:
squarePlusProductin classECFieldElement
-
invert
public ECFieldElement invert()
- Specified by:
invertin classECFieldElement
-
sqrt
public ECFieldElement 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
public boolean equals(Object anObject)
Description copied from class:ObjectCompares this instance with the specified object and indicates if they are equal. In order to be equal,omust represent the same object as this instance using a class-specific comparison. The general contract is that this comparison should be reflexive, symmetric, and transitive. Also, no object reference other than null is equal to null.The default implementation returns
trueonly ifthis == o. See Writing a correctequalsmethod if you intend implementing your ownequalsmethod.The general contract for the
equalsandObject.hashCode()methods is that ifequalsreturnstruefor any two objects, thenhashCode()must return the same value for these objects. This means that subclasses ofObjectusually override either both methods or neither of them.- Overrides:
equalsin classObject- Parameters:
anObject- the object to compare this instance with.- Returns:
trueif the specified object is equal to thisObject;falseotherwise.- See Also:
Object.hashCode()
-
hashCode
public int hashCode()
Description copied from class:ObjectReturns an integer hash code for this object. By contract, any two objects for whichObject.equals(java.lang.Object)returnstruemust return the same hash code value. This means that subclasses ofObjectusually override both methods or neither method.Note that hash values must not change over time unless information used in equals comparisons also changes.
See Writing a correct
hashCodemethod if you intend implementing your ownhashCodemethod.- Overrides:
hashCodein classObject- Returns:
- this object's hash code.
- See Also:
Object.equals(java.lang.Object)
-
-