public interface Element extends ElementPow
Element
interface. You can obtain an instance of an Element starting from an algebraic structure, such as a particular
finite field or elliptic curve group, represented by the Field
interface.Field
,
Field
,
ElementPowPreProcessing
Modifier and Type | Method and Description |
---|---|
Element |
add(Element element)
Sets this = this + element.
|
Element |
div(Element element)
Sets this = this / element
|
Element |
duplicate()
Returns a copy of this element.
|
ElementPowPreProcessing |
getElementPowPreProcessing()
Prepare to exponentiate this element and returns pre-processing information.
|
Field |
getField()
Returns the field to which this element lie.
|
Element |
getImmutable()
Returns an immutable copy of this element if the
element is not already immutable.
|
int |
getLengthInBytes()
Returns the length in bytes necessary to represent this element.
|
Element |
halve()
Sets this = this / 2.
|
Element |
invert()
Sets this to the inverse of itself.
|
boolean |
isEqual(Element value)
Returns true if this and value have the same value, false otherwise.
|
boolean |
isImmutable()
Returns true if this element is immutable, false otherwise.
|
boolean |
isOne()
Returns true if n is one, false otherwise.
|
boolean |
isSqr()
Returns true if this element is a perfect square (quadratic residue), false otherwise.
|
boolean |
isZero()
Returns true if n is zero, false otherwise.
|
Element |
mul(BigInteger n)
Sets this = this * n, that is this + this + ...
|
Element |
mul(Element element)
Sets this = this * element.
|
Element |
mul(int z)
Sets this = this * z, that is this + this + ...
|
Element |
mulZn(Element z)
Sets this = this * z, that is this + this + … + this where there are z this's and
z is an element of a ring Z_N for some N.
|
Element |
negate()
Set this = -this.
|
Element |
pow(BigInteger n)
Sets this = this^n.
|
Element |
powZn(Element n)
Sets this = this^n, where n is an element of a ring Z_N for some N
(typically the order of the algebraic structure n lies in).
|
Element |
set(BigInteger value)
Sets this element to value.
|
Element |
set(Element value)
Sets this element to value.
|
Element |
set(int value)
Sets this element to value.
|
int |
setFromBytes(byte[] source)
Reads this element from the buffer source.
|
int |
setFromBytes(byte[] source,
int offset)
Reads this element from the buffer source starting from offset.
|
Element |
setFromHash(byte[] source,
int offset,
int length)
Sets this element deterministically from the length bytes stored in the source parameter starting from the passed offset.
|
Element |
setToOne()
Sets this element to one.
|
Element |
setToRandom()
If this element lies in a finite algebraic structure, assigns a uniformly random element to it.
|
Element |
setToZero()
Sets this element to zero.
|
int |
sign()
If this element is zero, returns 0.
|
Element |
sqrt()
Sets this = sqrt(this).
|
Element |
square()
Se this = this^2.
|
Element |
sub(Element element)
Sets this = this - element.
|
BigInteger |
toBigInteger()
Converts this to a BigInteger if such operation makes sense.
|
byte[] |
toBytes()
Converts this element to bytes.
|
byte[] |
toCanonicalRepresentation()
Returns the canonical representation of this element.
|
Element |
twice()
Sets this = this + this.
|
Field getField()
int getLengthInBytes()
Field.getLengthInBytes()
boolean isImmutable()
getImmutable()
Element getImmutable()
isImmutable()
Element duplicate()
Element set(Element value)
value
- the new value of this element.Element set(int value)
value
- the new value of this element.Element set(BigInteger value)
value
- the new value of this element.BigInteger toBigInteger()
Element setToRandom()
Element setFromHash(byte[] source, int offset, int length)
source
- the buffer data.offset
- the starting offset.length
- the number of bytes to be used.int setFromBytes(byte[] source)
source
- the source of bytes.int setFromBytes(byte[] source, int offset)
source
- the source of bytes.offset
- the starting offset.byte[] toBytes()
byte[] toCanonicalRepresentation()
Element setToZero()
boolean isZero()
Element setToOne()
boolean isEqual(Element value)
value
- the element to be compared.boolean isOne()
Element twice()
Element square()
Element invert()
Element halve()
Element negate()
Element add(Element element)
element
- the value to be added.Element sub(Element element)
element
- the value to be subtracted.Element mul(Element element)
element
- the value to be multipliedElement mul(int z)
z
- the value to be multipliedElement mul(BigInteger n)
n
- the value to be multipliedElement mulZn(Element z)
z
- the value to be multipliedElement div(Element element)
element
- is the divisor.Element pow(BigInteger n)
pow
in interface ElementPow
n
- the exponent of the power.Element powZn(Element n)
powZn
in interface ElementPow
n
- the exponent of the power.ElementPowPreProcessing getElementPowPreProcessing()
ElementPowPreProcessing
Element sqrt()
boolean isSqr()
int sign()
Copyright © 2013. All rights reserved.