public final class QuadraticExtensionFieldElement extends Object
Modifier and Type | Method and Description |
---|---|
QuadraticExtensionFieldElement |
add(GenericFieldElement b)
Adds
b to this . |
QuadraticExtensionFieldElement |
addBase(GenericFieldElement b)
Adds
b to this where b is an element
of the underlying base field. |
QuadraticExtensionFieldElement |
addOutOfPlace(ExtensionFieldElement b)
Adds two elements and returns a new object holding the result.
|
QuadraticExtensionFieldElement |
addOutOfPlace(GenericFieldElement b)
Adds two elements and returns a new object holding the result.
|
QuadraticExtensionFieldElement |
addOutOfPlace(PrimeCharacteristicFieldElement b)
Adds two elements and returns a new object holding the result.
|
QuadraticExtensionFieldElement |
applyFrobenius(int i)
Compute the
i -th Frobenius of this . |
QuadraticExtensionFieldElement |
clone()
Clones the value of this field element.
|
QuadraticExtensionFieldElement |
conjugate()
Conjugate this element.
|
QuadraticExtensionFieldElement |
conjugate(int i)
Conjugate this element
i times. |
QuadraticExtensionFieldElement |
divide(GenericFieldElement b)
Divides
this and another field elements. |
QuadraticExtensionFieldElement |
divideBy2()
Divides
this by 2. |
boolean |
equals(Object obj) |
QuadraticExtensionFieldElement |
exponentiate(BigInteger n)
Raises
this to the power n . |
QuadraticExtensionFieldElement |
exponentiate(int n)
Raises
this to the power n . |
QuadraticExtensionFieldElement |
exponentiateByPowerOf2(int exponent)
Raise
this to the power of 2^n . |
QuadraticExtensionFieldElement |
exponentiateOutOfPlace(BigInteger n)
Raises
this to the power n . |
QuadraticExtensionFieldElement |
exponentiateOutOfPlace(int n)
Raises
this to the power n . |
iaik.security.ec.math.field.AbstractQuadraticExtensionField |
getField()
Returns the associated finite field.
|
PrimeFieldElement |
getNorm()
Computes the norm of
this , which is an element of the base
field. |
int |
getQuadraticCharacter()
Implements a quadratic character, which returns -1,0,1 depending on whether
this is a quadratic non-residue, a multiple of the modulus, or
a quadratic residue. |
PrimeCharacteristicFieldElement |
getValue(int index)
Get
index -th subfield element used to represent
this . |
GenericFieldElement[] |
getValues()
Get subfield elements used to represent
this . |
PrimeFieldElement[] |
getValuesRecursive()
Get prime field elements used to represent
this . |
int |
hashCode() |
QuadraticExtensionFieldElement |
invert()
Sets
this to its inverse. |
boolean |
isOne()
Determines whether
this is one. |
boolean |
isZero()
Determines whether
this is zero. |
QuadraticExtensionFieldElement |
multiply(BigInteger n)
Multiples
this by n . |
QuadraticExtensionFieldElement |
multiply(GenericFieldElement b)
Multiplies
this with b which is an element of the
same field. |
QuadraticExtensionFieldElement |
multiply(PrimeFieldElement b)
Multiply
this by a prime field element. |
QuadraticExtensionFieldElement |
multiplyBy2()
Multiplies
this with 2. |
QuadraticExtensionFieldElement |
multiplyBy2OutOfPlace()
Multiplies
this with 2 and returns a new object holding the
result. |
QuadraticExtensionFieldElement |
multiplyBy3()
Multiplies
this with 3. |
QuadraticExtensionFieldElement |
multiplyBy3OutOfPlace()
Multiplies
this with 3 and returns a new object holding the
result. |
QuadraticExtensionFieldElement |
multiplyByAdjointRoot()
Multiply
this by the root used to obtain the extension field. |
QuadraticExtensionFieldElement |
multiplyByAdjointRootOutOfPlace()
Multiply with adjoint root out of place
|
QuadraticExtensionFieldElement |
multiplyByBase(GenericFieldElement b)
Multiplies
this with b which is an element of the
base field. |
QuadraticExtensionFieldElement |
multiplyByBaseOutOfPlace(GenericFieldElement b)
Multiplies
this with b which is an element of the
base field, where a new object holding the result is created. |
QuadraticExtensionFieldElement |
multiplyByPowerOf2(int exponent)
Multiplies
this by 2^n . |
QuadraticExtensionFieldElement |
multiplyByPowerOf2OutOfPlace(int exponent)
Multiplies
this by 2^n and returns a new object
holding the result. |
QuadraticExtensionFieldElement |
multiplyOutOfPlace(BigInteger n)
Multiples
this by n , where a new object holding
the result is created. |
QuadraticExtensionFieldElement |
multiplyOutOfPlace(GenericFieldElement b)
Multiplies
this with b which is an element of the
same field, where a new object holding the result is created. |
QuadraticExtensionFieldElement |
multiplyOutOfPlace(PrimeFieldElement b)
Multiply
this by a prime field element, where a new object
holding the result is created. |
QuadraticExtensionFieldElement |
negate()
Returns the negative of
this . |
QuadraticExtensionFieldElement |
negateOutOfPlace()
Returns the negative of
this , where a new object holding the
result is created. |
QuadraticExtensionFieldElement |
square()
Computes the square of
this in-place. |
QuadraticExtensionFieldElement |
squareOutOfPlace()
Computes the square of
this , where a new object holding the
result is created. |
QuadraticExtensionFieldElement |
squareRoot()
Computes the square root of
this in-place. |
QuadraticExtensionFieldElement |
squareRoot(boolean checkSquare)
Computes the square root of
this . |
QuadraticExtensionFieldElement |
subtract(GenericFieldElement b)
Subtracts
b from this . |
QuadraticExtensionFieldElement |
subtractOutOfPlace(ExtensionFieldElement b)
Subtract two elements and returns a new object holding the result.
|
QuadraticExtensionFieldElement |
subtractOutOfPlace(GenericFieldElement b)
Subtracts
b from this which is an element of the
base field, where a new object holding the result is created. |
QuadraticExtensionFieldElement |
subtractOutOfPlace(PrimeCharacteristicFieldElement b)
Subtracts
b from this and returns a new object
holding the result. |
Object |
toBigIntegers()
Returns the (multi-dimensional)
BigInteger -array representation of
this instance. |
byte[] |
toByteArray()
Returns
byte -array representation of this instance. |
String |
toString() |
public GenericFieldElement[] getValues()
ExtensionFieldElement
this
.this
public PrimeCharacteristicFieldElement getValue(int index)
ExtensionFieldElement
index
-th subfield element used to represent
this
.index
- index of the desired subfield elementindex
-th subfield element used to represent
this
public QuadraticExtensionFieldElement invert()
GenericFieldElement
this
to its inverse.this
public QuadraticExtensionFieldElement multiply(GenericFieldElement b)
GenericFieldElement
this
with b
which is an element of the
same field.b
- the second factorthis
and b
public QuadraticExtensionFieldElement multiplyOutOfPlace(GenericFieldElement b)
GenericFieldElement
this
with b
which is an element of the
same field, where a new object holding the result is created.b
- the second factorthis
and b
public QuadraticExtensionFieldElement multiply(PrimeFieldElement b)
this
by a prime field element.b
- prime field elementthis
and b
public QuadraticExtensionFieldElement multiplyOutOfPlace(PrimeFieldElement b)
this
by a prime field element, where a new object
holding the result is created.b
- prime field elementthis
and b
public QuadraticExtensionFieldElement multiply(BigInteger n)
GenericFieldElement
this
by n
.n
- the factorthis
and n
public QuadraticExtensionFieldElement multiplyOutOfPlace(BigInteger n)
GenericFieldElement
this
by n
, where a new object holding
the result is created.n
- the factorthis
and n
public QuadraticExtensionFieldElement multiplyByBase(GenericFieldElement b)
GenericFieldElement
this
with b
which is an element of the
base field.b
- the second factorthis
and b
public QuadraticExtensionFieldElement multiplyByBaseOutOfPlace(GenericFieldElement b)
GenericFieldElement
this
with b
which is an element of the
base field, where a new object holding the result is created.b
- the second factorthis
and b
public QuadraticExtensionFieldElement multiplyBy2()
PrimeCharacteristicFieldElement
this
with 2.this
and 2public QuadraticExtensionFieldElement multiplyBy2OutOfPlace()
PrimeCharacteristicFieldElement
this
with 2 and returns a new object holding the
result.this
and 2public QuadraticExtensionFieldElement multiplyBy3()
PrimeCharacteristicFieldElement
this
with 3.this
and 3public QuadraticExtensionFieldElement multiplyBy3OutOfPlace()
PrimeCharacteristicFieldElement
this
with 3 and returns a new object holding the
result.this
and 3public QuadraticExtensionFieldElement multiplyByPowerOf2(int exponent)
PrimeCharacteristicFieldElement
this
by 2^n
.exponent
- the exponentthis
and 2^npublic QuadraticExtensionFieldElement multiplyByPowerOf2OutOfPlace(int exponent)
PrimeCharacteristicFieldElement
this
by 2^n
and returns a new object
holding the result.exponent
- the exponentthis
and 2^npublic QuadraticExtensionFieldElement negate()
GenericFieldElement
this
. This functions works in-place.this
public QuadraticExtensionFieldElement negateOutOfPlace()
GenericFieldElement
this
, where a new object holding the
result is created.this
public QuadraticExtensionFieldElement add(GenericFieldElement b)
GenericFieldElement
b
to this
. This functions works in-place.b
- the second addendthis
and b
public QuadraticExtensionFieldElement addOutOfPlace(GenericFieldElement b)
PrimeCharacteristicFieldElement
b
- the other valuepublic QuadraticExtensionFieldElement addOutOfPlace(PrimeCharacteristicFieldElement b)
PrimeCharacteristicFieldElement
b
- the other valuepublic QuadraticExtensionFieldElement addOutOfPlace(ExtensionFieldElement b)
ExtensionFieldElement
b
- the other valuepublic QuadraticExtensionFieldElement addBase(GenericFieldElement b)
GenericFieldElement
b
to this
where b
is an element
of the underlying base field.b
- the second addendthis
and b
public QuadraticExtensionFieldElement subtract(GenericFieldElement b)
GenericFieldElement
b
from this
. This functions works in-place.b
- the subtrahendthis
and b
public QuadraticExtensionFieldElement subtractOutOfPlace(GenericFieldElement b)
GenericFieldElement
b
from this
which is an element of the
base field, where a new object holding the result is created.b
- the second factorthis
and b
public QuadraticExtensionFieldElement subtractOutOfPlace(ExtensionFieldElement b)
ExtensionFieldElement
b
- the other valuepublic QuadraticExtensionFieldElement subtractOutOfPlace(PrimeCharacteristicFieldElement b)
PrimeCharacteristicFieldElement
b
from this
and returns a new object
holding the result.b
- the subtrahendthis
and b
public QuadraticExtensionFieldElement conjugate()
ExtensionFieldElement
this
public QuadraticExtensionFieldElement divide(GenericFieldElement b)
ExtensionFieldElement
this
and another field elements.
You have no guarantee that b
remains unchanged.
b
- the divisorthis
and b
public QuadraticExtensionFieldElement divideBy2()
PrimeCharacteristicFieldElement
this
by 2.this
divided by 2.public QuadraticExtensionFieldElement square()
GenericFieldElement
this
in-place.this
public QuadraticExtensionFieldElement squareOutOfPlace()
GenericFieldElement
this
, where a new object holding the
result is created.this
public QuadraticExtensionFieldElement squareRoot()
GenericFieldElement
this
in-place.this
or null
if the
square root does not exist.public QuadraticExtensionFieldElement squareRoot(boolean checkSquare)
PrimeCharacteristicFieldElement
this
.checkSquare
- check if a
is a square. If true
, the
return value is undefined for non-squares.this
public QuadraticExtensionFieldElement exponentiate(BigInteger n)
GenericFieldElement
this
to the power n
.
Works in-place.n
- the exponentn
th power of this
public QuadraticExtensionFieldElement exponentiate(int n)
GenericFieldElement
this
to the power n
.
Works in-place.n
- the exponentn
th power of this
public QuadraticExtensionFieldElement exponentiateOutOfPlace(BigInteger n)
GenericFieldElement
this
to the power n
.n
- the exponentn
th power of this
public QuadraticExtensionFieldElement exponentiateOutOfPlace(int n)
GenericFieldElement
this
to the power n
.n
- the exponentn
th power of this
public QuadraticExtensionFieldElement exponentiateByPowerOf2(int exponent)
GenericFieldElement
this
to the power of 2^n
.exponent
- the exponentn
-th power of this
.public QuadraticExtensionFieldElement conjugate(int i)
ExtensionFieldElement
i
times.i
- number of times this
should be conjugatedthis
public QuadraticExtensionFieldElement applyFrobenius(int i)
ExtensionFieldElement
i
-th Frobenius of this
.i
- number of times the Frobenius map should be appliedi
-times to this
..public PrimeFieldElement getNorm()
ExtensionFieldElement
this
, which is an element of the base
field.a
public QuadraticExtensionFieldElement multiplyByAdjointRoot()
ExtensionFieldElement
this
by the root used to obtain the extension field.this
multiplied by the adjoint root.public QuadraticExtensionFieldElement multiplyByAdjointRootOutOfPlace()
this
and the adjoint rootpublic int getQuadraticCharacter()
PrimeCharacteristicFieldElement
this
is a quadratic non-residue, a multiple of the modulus, or
a quadratic residue.(this/p)
public boolean isOne()
GenericFieldElement
this
is one.this
is the one elementpublic boolean isZero()
GenericFieldElement
this
is zero.this
is the zero elementpublic Object toBigIntegers()
ExtensionFieldElement
BigInteger
-array representation of
this instance.BigInteger
-array representationpublic iaik.security.ec.math.field.AbstractQuadraticExtensionField getField()
GenericFieldElement
public int hashCode()
hashCode
in interface GenericFieldElement
hashCode
in class Object
public boolean equals(Object obj)
equals
in interface GenericFieldElement
equals
in class Object
public QuadraticExtensionFieldElement clone()
ExtensionFieldElement
clone
in interface ExtensionFieldElement
clone
in interface GenericFieldElement
clone
in interface PrimeCharacteristicFieldElement
public String toString()
toString
in interface GenericFieldElement
toString
in class Object
public PrimeFieldElement[] getValuesRecursive()
ExtensionFieldElement
this
. This calls
ExtensionFieldElement.getValues()
recursively.
They values are sorted from the coefficients of the lowest power to the the
highest power.getValuesRecursive
in interface ExtensionFieldElement
this
.public byte[] toByteArray()
ExtensionFieldElement
byte
-array representation of this instance.toByteArray
in interface ExtensionFieldElement
toByteArray
in interface GenericFieldElement
byte
-array representationCopyright © 2011–2022 Stiftung SIC. All rights reserved.