public class ProductGroupElement extends java.lang.Object implements GroupElement
| Modifier and Type | Field and Description |
|---|---|
protected GroupElement[] |
elems |
| Constructor and Description |
|---|
ProductGroupElement(GroupElement... elems) |
ProductGroupElement(java.util.List<? extends GroupElement> elems) |
ProductGroupElement(Representation repr) |
| Modifier and Type | Method and Description |
|---|---|
GroupElementVector |
asVector() |
GroupElement |
compute()
Hint that the concrete value of this GroupElement will be accessed soon
(e.g., via
getRepresentation() or equals()). |
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) |
GroupElement |
get(int index) |
Representation |
getRepresentation()
The representation of this object.
|
ProductGroup |
getStructure()
Returns the
Structure that this Element belongs to. |
int |
hashCode() |
ProductGroupElement |
inv()
Calculates the inverse of this group element.
|
boolean |
isComputed()
Returns true if a concrete value has already been computed.
|
ProductGroupElement |
op(Element e)
Calculates the result of
this.op(e). |
ProductGroupElement |
pow(java.math.BigInteger k)
Calculates the result of applying the group operation k times.
|
GroupElement |
precomputePow(int windowSize)
Advises the
GroupElement to prepare it for later pow() calls. |
ByteAccumulator |
updateAccumulator(ByteAccumulator accumulator)
Updates the ByteAccumulator with the unique byte representation of this object.
|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitexpr, isEqualTo, isEqualTo, isEqualTo, isNeutralElement, op, op, pow, pow, pow, pow, pow, pow, precomputePow, squaregetUniqueByteRepresentationprotected GroupElement[] elems
public ProductGroupElement(java.util.List<? extends GroupElement> elems)
public ProductGroupElement(GroupElement... elems)
public ProductGroupElement(Representation repr)
public ProductGroup getStructure()
ElementStructure that this Element belongs to.getStructure in interface ElementgetStructure in interface GroupElementpublic ProductGroupElement inv()
GroupElementinv in interface GroupElementx such that x.op(this).equals(getStructure().getNeutralElement())public ProductGroupElement 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 ProductGroupElement pow(java.math.BigInteger k)
GroupElementthis.inv().pow(-k).pow 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 GroupElementpublic boolean isComputed()
GroupElementisComputed in interface GroupElementpublic GroupElement get(int index)
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 GroupElementVector asVector()
public Representation getRepresentation()
RepresentableReprUtilgetRepresentation in interface RepresentableRepresentationpublic boolean equals(java.lang.Object o)