|
IAIK ECC version 2.18 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object iaik.security.ecc.math.field.FieldElement
Representation of an element over a specified field with a
certain value. Use the factory to create the desired field and
the field's newElement
method to create a field element.
To perform field arithmetics use the FieldElement methods.
!!ATTENTION DON'T MIX UP FIELDELEMENTS OF DIFFERENT FIELDS !!
Field Summary | |
protected Field |
field_
A FieldElement constist of a value and an underlying field. |
protected iaik.security.ecc.math.field.Value |
value_
A FieldElement constist of a value and an underlying field. |
Method Summary | |
FieldElement |
add(FieldElement b)
Calculates: this += b Calls the corresponding field method. |
static FieldElement |
add(FieldElement a,
FieldElement b)
Use this static method if you want to create a new FieldElement with the value of a + b. |
java.lang.Object |
clone()
Creates a new FieldElement with the value cloned over the same field. |
FieldElement |
divide(FieldElement b)
Calculates: this *= invert(b) Calls the corresponding field method. |
static FieldElement |
divide(FieldElement a,
FieldElement b)
Use this static method if you want to create a new FieldElement with the value of a * invert(b). |
boolean |
equals(java.lang.Object other)
Compares to FieldElements. |
Field |
getField()
A FieldElement constist of a value and an underlying field. |
FieldElement |
half()
Halfs ONLY a prime field element, binary fields are not supported. |
int |
hashCode()
Returns the hash code of this field element. |
FieldElement |
invert()
Inverts (multiplicative) the element. |
static FieldElement |
invert(FieldElement a)
Use this static method if you want to create a new FieldElement with the value of multiplicatice inverse of a. |
static FieldElement[] |
invertSimultaneous(FieldElement[] a)
Use this static method if you want to simultaneously invert an array of FieldElements. |
boolean |
isOne()
Tests if the value is the ONE elemnt |
boolean |
isZero()
Tests if the value is the ZERO elemnt |
FieldElement |
multiply(FieldElement b)
Calculates: this *= b Calls the corresponding field method. |
static FieldElement |
multiply(FieldElement a,
FieldElement b)
Use this static method if you want to create a new FieldElement with the value of a * b. |
FieldElement |
negate()
Negates the element (additive inverse). |
static FieldElement |
negate(FieldElement a)
Use this static method if you want to create a new FieldElement with the negative value of a. |
FieldElement |
square()
Calculates: this squared Calls the corresponding field method. |
static FieldElement |
square(FieldElement a)
Use this static method if you want to create a new FieldElement with the value of a squared. |
FieldElement |
sub(FieldElement b)
Calculates: this -= b Negates b and adds it to a. |
static FieldElement |
sub(FieldElement a,
FieldElement b)
Use this static method if you want to create a new FieldElement with the value of a - b. |
boolean |
testBit(int bitPosition)
Tests the specified bit. |
java.math.BigInteger |
toBigInt()
|
byte[] |
toByteArray()
Performs the Field Element to Octet String Conversion Primitive (FE2OSP) as defined in P1363. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
protected Field field_
protected iaik.security.ecc.math.field.Value value_
Method Detail |
public static FieldElement add(FieldElement a, FieldElement b)
a
- one addendb
- the other addend
public static FieldElement divide(FieldElement a, FieldElement b) throws FieldException
a
- the dividendb
- the divisor
FieldException
- if the multiplicative inverse doesn't existpublic static FieldElement invert(FieldElement a)
a
- the field element
public static FieldElement[] invertSimultaneous(FieldElement[] a)
a
- the field element array
public static FieldElement multiply(FieldElement a, FieldElement b)
a
- one factorb
- the other factor
public static FieldElement negate(FieldElement a)
a
- the field element
public static FieldElement square(FieldElement a)
public static FieldElement sub(FieldElement a, FieldElement b)
a
- the minuendb
- the subtrahend (negate b and add to a)
public FieldElement add(FieldElement b)
b
- the addend must be defined over the same field.
this
) to
enable chaining of arithmetic operations like:
element.add(other).sub(another)
Field.add(iaik.security.ecc.math.field.FieldElement, iaik.security.ecc.math.field.FieldElement)
public java.lang.Object clone()
public FieldElement divide(FieldElement b)
b
- the divisor must be defined over the same field.
this
) to
enable chaining of arithmetic operations like:
element.add(other).sub(another)
public boolean equals(java.lang.Object other)
public Field getField()
public int hashCode()
public FieldElement half()
this
) to
enable chaining of arithmetic operations like:
element.add(other).sub(another)
public FieldElement invert()
this
) to
enable chaining of arithmetic operations like:
element.add(other).sub(another)
public boolean isOne()
public boolean isZero()
public FieldElement multiply(FieldElement b)
b
- the factor must be defined over the same field.
this
) to
enable chaining of arithmetic operations like:
element.add(other).sub(another)
Field.multiply(iaik.security.ecc.math.field.FieldElement, iaik.security.ecc.math.field.FieldElement)
public FieldElement negate()
this
) to
enable chaining of arithmetic operations like:
element.add(other).sub(another)
Field.negate(iaik.security.ecc.math.field.FieldElement)
public FieldElement square()
this
) to
enable chaining of arithmetic operations like:
element.add(other).sub(another)
Field.square(iaik.security.ecc.math.field.FieldElement)
public FieldElement sub(FieldElement b)
b
- the subtrahend must be defined over the same field.
this
) to
enable chaining of arithmetic operations like:
element.add(other).sub(another)
Field.add(iaik.security.ecc.math.field.FieldElement, iaik.security.ecc.math.field.FieldElement)
public boolean testBit(int bitPosition)
bitPosition
- the bit to be tested, this parameter mustn't be negative
public java.lang.String toString()
public java.math.BigInteger toBigInt()
public byte[] toByteArray()
|
IAIK ECC version 2.18 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |