public class CountingGroupElement extends java.lang.Object implements GroupElement
CountingGroup.
As CountingGroup itself consists of two nested groups, CountingGroupElement also essentially
wraps two group elements, one for each nested group. Group operations are done for both.
CountingGroup| Modifier and Type | Field and Description |
|---|---|
protected LazyGroupElement |
elemExpMultiExp
This element as a member of the group responsible for counting (multi-)exponentiations.
|
protected LazyGroupElement |
elemTotal
This element as a member of the group responsible for counting total group operations.
|
protected CountingGroup |
group
The group this element belongs to.
|
| Constructor and Description |
|---|
CountingGroupElement(CountingGroup group,
LazyGroupElement elemTotal,
LazyGroupElement elemExpMultiExp)
Initializes this group element as belonging to the given group and wrapping the two given group elements.
|
CountingGroupElement(CountingGroup group,
Representation repr) |
| Modifier and Type | Method and Description |
|---|---|
GroupElement |
compute()
Since asynchronous computation makes count data unreliable, this method works like
computeSync(). |
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) |
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.
|
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. |
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, isNeutralElement, op, op, pow, pow, pow, pow, pow, pow, squaregetUniqueByteRepresentationprotected CountingGroup group
protected LazyGroupElement elemTotal
protected LazyGroupElement elemExpMultiExp
public CountingGroupElement(CountingGroup group, LazyGroupElement elemTotal, LazyGroupElement elemExpMultiExp)
group - the group this element should belong toelemTotal - the version of this group element belonging to the group counting total group operationselemExpMultiExp - the version of this group element belonging to the group counting (multi)-exponentiationspublic CountingGroupElement(CountingGroup group, Representation repr)
public Representation getRepresentation()
RepresentableReprUtilgetRepresentation in interface RepresentableRepresentationpublic 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 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()
computeSync().compute in interface GroupElementcomputeSync()public GroupElement computeSync()
GroupElementcompute()
which does the same, but asynchronously (i.e. concurrently).computeSync in interface GroupElementpublic boolean isComputed()
GroupElementisComputed in interface GroupElementpublic 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 boolean equals(java.lang.Object o)
public int hashCode()
public java.lang.String toString()
toString in class java.lang.Object