|
IAIK ECC version 2.18 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Abstract representation of a finite field (e.g. prime field, or binary field).
Every implementation must implement this interface and use the FieldFactory
to get an instance.
This interface defines the following field operations:
add
performs the add "+" field operation.
negate
calculates the additive inverse element.
multiply
performs the multiply "*" field operation.
invert
calculates the multiplicative inverse element.
square
additional the square operation is defined. Since there
exist very efficient squaring algorithms (especially over fields with char. 2) this method
has been added.
To perform the field operation, create the required field elements (use the
newElement
methods) and use their arithmetic methods.
!! ATTENTION !! DON'T MIX UP DIFFERENT FIELDS
For performance reasons some implementations may omit type checking, and since all fields are derived from the same base class (and so are the values) this may result in class cast exceptions.
FieldFactory
Method Summary | |
void |
add(FieldElement a,
FieldElement b)
Computes a += b ATTENTION: you mustn't provide elements of different fields. |
FieldFactory |
getFieldFactory()
|
int |
getFieldId()
The type of the field (prime or binary) |
FieldElement |
getONEelement()
Get the ONE (multiplicative neutral) element of this field. |
java.math.BigInteger |
getSize()
|
FieldElement |
getZEROelement()
Get the ZERO (additive neutral) element of this field. |
void |
invert(FieldElement a)
Calculates the multiplicative inverse. |
void |
multiply(FieldElement a,
FieldElement b)
Computes a *= b; ATTENTION: you mustn't provide elements of different fields. |
void |
negate(FieldElement a)
Negates a field element (additive inverse operation). |
FieldElement |
newElement(byte[] b)
Creates a new field element performing the octet string to field element conversation primitive as described in P1363 and X9.62 |
void |
square(FieldElement a)
Squares the specified field element. |
iaik.asn1.ASN1Object |
toASN1Object()
|
Method Detail |
public void add(FieldElement a, FieldElement b)
a
- the first addend and result.b
- the second addend.public FieldFactory getFieldFactory()
public int getFieldId()
BinaryField.BINARY_FIELD_ID
,
PrimeField.PRIME_FIELD_ID
public FieldElement getONEelement()
public java.math.BigInteger getSize()
public FieldElement getZEROelement()
public void invert(FieldElement a)
a
- the field element to be inverted.public void multiply(FieldElement a, FieldElement b)
a
- the multiplicand and resultb
- the multiplier.public void negate(FieldElement a)
a
- the field element to be negated.public FieldElement newElement(byte[] b)
public void square(FieldElement a)
a
- the field element to be squared.public iaik.asn1.ASN1Object toASN1Object()
|
IAIK ECC version 2.18 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |