public final class BinaryFieldElement extends Object implements FieldElement
Also note that (almost) all methods in this class work in-place. So, there is no guarantee that values input to methods in this class will not be overridden. In case of doubt and if values need to be reused, always clone the value, before inputting it to a method.
FieldElement,
BinaryField| Modifier and Type | Method and Description |
|---|---|
BinaryFieldElement |
add(BinaryFieldElement b,
boolean preserveB)
Performs either the addition
a += b or b += a, if
preserveB is set to false. |
BinaryFieldElement |
add(GenericFieldElement b)
Adds
b to this. |
BinaryFieldElement |
addBase(GenericFieldElement b)
Adds
b to this where b is an element
of the underlying base field. |
BinaryFieldElement |
addOutOfPlace(GenericFieldElement b)
Adds
this with b which is an element of the base
field, where a new object holding the result is created. |
BinaryFieldElement |
clone()
Clones the value of this field element.
|
BinaryFieldElement |
divide(GenericFieldElement b)
Divides
this and another field elements. |
boolean |
equals(Object obj) |
BinaryFieldElement |
exponentiate(BigInteger n)
Raises
this to the power n. |
BinaryFieldElement |
exponentiate(int n)
Raises
this to the power n. |
BinaryFieldElement |
exponentiateByPowerOf2(int n)
Raises this element to the power
2n. |
BinaryFieldElement |
exponentiateOutOfPlace(BigInteger n)
Raises
this to the power n. |
BinaryFieldElement |
exponentiateOutOfPlace(int n)
Raises
this to the power n. |
int |
getBit(int index)
Returns the value of a certain bit of
this. |
PrecomputationData |
getExtendedPrecomputationData()
Compiles 256 precomputed values for the multiplication algorithm.
|
BinaryField |
getField()
Returns the associated finite field.
|
PrecomputationData |
getPrecomputationData()
Compiles 16 precomputed values for the multiplication algorithm.
|
int |
getTrace()
Determines the trace of
this. |
int |
hashCode() |
BinaryFieldElement |
invert()
Sets
this to its inverse. |
boolean |
isOne()
Determines whether
this is one. |
boolean |
isZero()
Determines whether
this is zero. |
BinaryFieldElement |
multiply(BigInteger n)
Multiples
this by n. |
BinaryFieldElement |
multiply(GenericFieldElement b)
Multiplies
this with b which is an element of the
same field. |
BinaryFieldElement |
multiply(PrecomputationData data)
Multiplies
this with the already available precomputation data
of b, where a new object holding the result is created. |
BinaryFieldElement |
multiplyByBase(GenericFieldElement b)
Multiplies
this with b which is an element of the
base field. |
BinaryFieldElement |
multiplyByBaseOutOfPlace(GenericFieldElement b)
Multiplies
this with b which is an element of the
base field, where a new object holding the result is created. |
BinaryFieldElement |
multiplyOutOfPlace(BigInteger n)
Multiples
this by n, where a new object holding
the result is created. |
BinaryFieldElement |
multiplyOutOfPlace(GenericFieldElement b)
Multiplies
this with b which is an element of the
same field, where a new object holding the result is created. |
BinaryFieldElement |
multiplyOutOfPlace(PrecomputationData data)
Multiplies
this with the already available precomputation data
of b. |
BinaryFieldElement |
negate()
Returns the negative of
this. |
BinaryFieldElement |
negateOutOfPlace()
Returns the negative of
this, where a new object holding the
result is created. |
BinaryFieldElement |
square()
Computes the square of
this in-place. |
BinaryFieldElement |
squareOutOfPlace()
Computes the square of
this, where a new object holding the
result is created. |
BinaryFieldElement |
squareRoot()
Computes the square root of
this. |
BinaryFieldElement |
subtract(GenericFieldElement b)
Subtracts
b from this. |
BinaryFieldElement |
subtractOutOfPlace(GenericFieldElement b)
Subtracts
b from this which is an element of the
base field, where a new object holding the result is created. |
boolean |
testBit(int index)
Tests whether a certain bit of
this is set. |
BigInteger |
toBigInteger()
Returns the
BigInteger-representation of this instance. |
byte[] |
toByteArray()
Returns the
byte[] representation of this instance. |
String |
toString() |
public BinaryFieldElement negate()
GenericFieldElementthis. This functions works in-place.negate in interface FieldElementnegate in interface GenericFieldElementthispublic BinaryFieldElement negateOutOfPlace()
GenericFieldElementthis, where a new object holding the
result is created.negateOutOfPlace in interface GenericFieldElementthispublic BinaryFieldElement add(GenericFieldElement b)
GenericFieldElementb to this. This functions works in-place.add in interface FieldElementadd in interface GenericFieldElementb - the second addendthis and bpublic BinaryFieldElement addOutOfPlace(GenericFieldElement b)
GenericFieldElementthis with b which is an element of the base
field, where a new object holding the result is created.addOutOfPlace in interface GenericFieldElementb - the second factorthis and bpublic BinaryFieldElement addBase(GenericFieldElement b)
GenericFieldElementb to this where b is an element
of the underlying base field.addBase in interface FieldElementaddBase in interface GenericFieldElementb - the second addendthis and bpublic BinaryFieldElement add(BinaryFieldElement b, boolean preserveB)
a += b or b += a, if
preserveB is set to false. Otherwise, it acts as
add(GenericFieldElement).b - the addendpreserveB - if true, b will be preserved, otherwise its content
may be exchanged by the resultpublic BinaryFieldElement subtract(GenericFieldElement b)
GenericFieldElementb from this. This functions works in-place.subtract in interface FieldElementsubtract in interface GenericFieldElementb - the subtrahendthis and bpublic BinaryFieldElement subtractOutOfPlace(GenericFieldElement b)
GenericFieldElementb from this which is an element of the
base field, where a new object holding the result is created.subtractOutOfPlace in interface GenericFieldElementb - the second factorthis and bpublic BinaryFieldElement invert()
GenericFieldElementthis to its inverse.invert in interface FieldElementinvert in interface GenericFieldElementthispublic BinaryFieldElement multiply(GenericFieldElement b)
GenericFieldElementthis with b which is an element of the
same field.multiply in interface FieldElementmultiply in interface GenericFieldElementb - the second factorthis and bpublic BinaryFieldElement multiplyOutOfPlace(GenericFieldElement b)
GenericFieldElementthis with b which is an element of the
same field, where a new object holding the result is created.multiplyOutOfPlace in interface FieldElementmultiplyOutOfPlace in interface GenericFieldElementb - the second factorthis and bpublic BinaryFieldElement multiply(BigInteger n)
GenericFieldElementthis by n.multiply in interface FieldElementmultiply in interface GenericFieldElementn - the factorthis and npublic BinaryFieldElement multiplyOutOfPlace(BigInteger n)
GenericFieldElementthis by n, where a new object holding
the result is created.multiplyOutOfPlace in interface FieldElementmultiplyOutOfPlace in interface GenericFieldElementn - the factorthis and npublic BinaryFieldElement multiplyByBase(GenericFieldElement b)
GenericFieldElementthis with b which is an element of the
base field.multiplyByBase in interface FieldElementmultiplyByBase in interface GenericFieldElementb - the second factorthis and bpublic BinaryFieldElement multiplyByBaseOutOfPlace(GenericFieldElement b)
GenericFieldElementthis with b which is an element of the
base field, where a new object holding the result is created.multiplyByBaseOutOfPlace in interface FieldElementmultiplyByBaseOutOfPlace in interface GenericFieldElementb - the second factorthis and bpublic BinaryFieldElement multiply(PrecomputationData data)
this with the already available precomputation data
of b, where a new object holding the result is created.data - the precomputation data for the factor bthis and bpublic BinaryFieldElement multiplyOutOfPlace(PrecomputationData data)
this with the already available precomputation data
of b.data - the precomputation data for the factor bthis and bpublic PrecomputationData getExtendedPrecomputationData()
this is referenced inside the precomputation
data. Hence, if it is changed afterwards, also the precomputation data
changes!!public PrecomputationData getPrecomputationData()
this is referenced inside the precomputation
data. Hence, if it is changed afterwards, also the precomputation data
changes!!public BinaryFieldElement divide(GenericFieldElement b)
GenericFieldElementthis and another field elements.divide in interface FieldElementdivide in interface GenericFieldElementb - the divisorthis and bpublic BinaryFieldElement squareRoot()
FieldElementthis.squareRoot in interface FieldElementsquareRoot in interface GenericFieldElementthispublic BinaryFieldElement square()
GenericFieldElementthis in-place.square in interface FieldElementsquare in interface GenericFieldElementthispublic BinaryFieldElement squareOutOfPlace()
GenericFieldElementthis, where a new object holding the
result is created.squareOutOfPlace in interface FieldElementsquareOutOfPlace in interface GenericFieldElementthispublic BinaryFieldElement exponentiate(BigInteger n)
GenericFieldElementthis to the power n.
Works in-place.exponentiate in interface FieldElementexponentiate in interface GenericFieldElementn - the exponentnth power of thispublic BinaryFieldElement exponentiate(int n)
GenericFieldElementthis to the power n.
Works in-place.exponentiate in interface GenericFieldElementn - the exponentnth power of thispublic BinaryFieldElement exponentiateOutOfPlace(BigInteger n)
GenericFieldElementthis to the power n.exponentiateOutOfPlace in interface GenericFieldElementn - the exponentnth power of thispublic BinaryFieldElement exponentiateOutOfPlace(int n)
GenericFieldElementthis to the power n.exponentiateOutOfPlace in interface GenericFieldElementn - the exponentnth power of thispublic BinaryFieldElement exponentiateByPowerOf2(int n)
2n.exponentiateByPowerOf2 in interface GenericFieldElementn - the power of 22nth power of thispublic int getTrace()
this.t in F2 of
thispublic BinaryField getField()
GenericFieldElementgetField in interface GenericFieldElementpublic boolean testBit(int index)
FieldElementthis is set.testBit in interface FieldElementindex - the index of the bitpublic int getBit(int index)
FieldElementthis.getBit in interface FieldElementindex - the index of the bitpublic boolean isOne()
GenericFieldElementthis is one.isOne in interface GenericFieldElementthis is the one elementpublic boolean isZero()
GenericFieldElementthis is zero.isZero in interface GenericFieldElementthis is the zero elementpublic BigInteger toBigInteger()
FieldElementBigInteger-representation of this instance.toBigInteger in interface FieldElementBigInteger-representationpublic byte[] toByteArray()
GenericFieldElementbyte[] representation of this instance.toByteArray in interface GenericFieldElementbyte[] representationpublic BinaryFieldElement clone()
FieldElementclone in interface FieldElementclone in interface GenericFieldElementclone in class Objectpublic boolean equals(Object obj)
equals in interface GenericFieldElementequals in class Objectpublic int hashCode()
hashCode in interface GenericFieldElementhashCode in class Objectpublic String toString()
toString in interface GenericFieldElementtoString in class ObjectCopyright © 2011–2022 Stiftung SIC. All rights reserved.