public abstract class LazyGroupElement extends java.lang.Object implements GroupElement
| Modifier and Type | Class and Description |
|---|---|
protected static class |
LazyGroupElement.ComputationState |
| Constructor and Description |
|---|
LazyGroupElement(LazyGroup group) |
LazyGroupElement(LazyGroup group,
GroupElementImpl concreteValue) |
| Modifier and Type | Method and Description |
|---|---|
protected GroupElementImpl |
accumulateMultiexp(Multiexponentiation multiexp)
Writes down the value of this group element as a multiexponentiation.
|
GroupElement |
compute()
Hint that the concrete value of this GroupElement will be accessed soon
(e.g., via
getRepresentation() or equals()). |
protected abstract void |
computeConcreteValue()
Computes the concrete value of the expression.
|
GroupElement |
computeSync()
Will compute stuff synchronously (this call blocks) so that the next call
requiring the concrete value of this group element can immediately retrieve it.
|
boolean |
equals(java.lang.Object o) |
protected GroupElementImpl |
getConcreteValue()
Returns the concrete group element behind this LazyGroupElement.
|
SmallExponentPrecomputation |
getPrecomputedSmallExponents() |
Representation |
getRepresentation()
The representation of this object.
|
Group |
getStructure()
Returns the
Structure that this Element belongs to. |
int |
hashCode() |
GroupElement |
inv()
Calculates the inverse of this group element.
|
boolean |
isComputed()
Returns true if a concrete value has already been computed.
|
protected boolean |
isDefinitelySupposedToGetConcreteValue()
Generally, when computing the value of some LazyGroupElement, there is no need to compute the values of all LazyGroupElements
related to it on the way.
|
boolean |
isNeutralElement()
Returns true iff this is the neutral element of the group.
|
GroupElement |
op(Element e)
Calculates the result of
this.op(e). |
GroupElement |
pow(java.math.BigInteger exponent)
Calculates the result of applying the group operation k times.
|
GroupElement |
precomputePow()
Advises the
GroupElement to prepare it for later pow() calls. |
GroupElement |
precomputePow(int windowSize)
Advises the
GroupElement to prepare it for later pow() calls. |
protected void |
setConcreteValue(GroupElementImpl impl) |
GroupElement |
square()
Computes
this.op(this). |
java.lang.String |
toString() |
ByteAccumulator |
updateAccumulator(ByteAccumulator accumulator)
Updates the ByteAccumulator with the unique byte representation of this object.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, waitexpr, isEqualTo, isEqualTo, isEqualTo, op, op, pow, pow, pow, pow, pow, powgetUniqueByteRepresentationprotected LazyGroup group
public LazyGroupElement(LazyGroup group)
public LazyGroupElement(LazyGroup group, GroupElementImpl concreteValue)
public Group getStructure()
ElementStructure that this Element belongs to.getStructure in interface ElementgetStructure in interface GroupElementpublic GroupElement inv()
GroupElementinv in interface GroupElementx such that x.op(this).equals(getStructure().getNeutralElement())public GroupElement op(Element e) throws java.lang.IllegalArgumentException
GroupElementthis.op(e).op in interface GroupElemente - right hand side of the operationjava.lang.IllegalArgumentException - if e is of the wrong typepublic GroupElement square()
GroupElementthis.op(this).
Useful if this group allows squaring to be more efficiently implemented than general exponentiation as is the case for elliptic curves.
square in interface GroupElementpublic GroupElement pow(java.math.BigInteger exponent)
GroupElementthis.inv().pow(-k).pow in interface GroupElementpublic GroupElement precomputePow()
GroupElementGroupElement to prepare it for later pow() calls.
This will take some time and should only be done ahead of time.
That is, the usual usage pattern should be:
//Setting up your encryption scheme (or whatever)
GroupElement g = group.getUniformlyRandomElement().precomputePow();
//Then (maybe even multiple) future calls of
GroupElement encrypt(GroupElement m) {
return m.op(g.pow(sk)).compute();
}
Don't use g.precomputePow().pow(x).compute();
unless you're planning to do more exponentiations of g in the future.
Uses a reasonable default for the memory consumed by this.
Use GroupElement.precomputePow(int) to customize.precomputePow in interface GroupElementpublic GroupElement precomputePow(int windowSize)
GroupElementGroupElement to prepare it for later pow() calls.
This will take some time and should only be done ahead of time.
That is, the usual usage pattern should be:
//Setting up your encryption scheme (or whatever)
GroupElement g = group.getUniformlyRandomElement().precomputePow();
//Then (maybe even multiple) future calls of
GroupElement encrypt(GroupElement m) {
return m.op(g.pow(sk)).compute();
}
Don't use g.precomputePow().pow(x).compute();
unless you're planning to do more exponentiations of g in the future.precomputePow in interface GroupElementwindowSize - an indicator for how much memory you're willing to invest.
Precomputation will take up space of roughly 2^(windowSize) group elements.public GroupElement compute()
GroupElementgetRepresentation() or equals()). Will start computing stuff in the background.compute in interface GroupElementpublic GroupElement computeSync()
GroupElementcompute()
which does the same, but asynchronously (i.e. concurrently).computeSync in interface GroupElementprotected void setConcreteValue(GroupElementImpl impl)
protected GroupElementImpl getConcreteValue()
protected boolean isDefinitelySupposedToGetConcreteValue()
protected abstract void computeConcreteValue()
protected GroupElementImpl accumulateMultiexp(Multiexponentiation multiexp)
public SmallExponentPrecomputation getPrecomputedSmallExponents()
public boolean isComputed()
GroupElementisComputed in interface GroupElementpublic boolean equals(java.lang.Object o)
public boolean isNeutralElement()
GroupElementisNeutralElement in interface GroupElementpublic int hashCode()
public ByteAccumulator updateAccumulator(ByteAccumulator accumulator)
UniqueByteRepresentableThe input to the accumulators update function is an injective (with respect to a given domain) byte encoding of this object.
For many use-cases, the AnnotatedUbrUtil can be used to quickly implement this method.
updateAccumulator in interface UniqueByteRepresentablepublic Representation getRepresentation()
RepresentableReprUtilgetRepresentation in interface RepresentableRepresentationpublic java.lang.String toString()
toString in class java.lang.Object