public class DebugGroup extends java.lang.Object implements Group
This counting capability is realized by using two LazyGroups that each wrap a DebugGroupImpl.
One counts total group operations and squarings, and the other counts (multi-)exponentiations as a single unit
(not including group operations and squarings done inside (multi-)exponentiations).
| Constructor and Description |
|---|
DebugGroup(LazyGroup groupTotal,
LazyGroup groupExpMultiExp)
This constructor allows instantiating the
DebugGroup with specific LazyGroup instances. |
DebugGroup(Representation repr) |
DebugGroup(java.lang.String name,
java.math.BigInteger n)
Initializes the counting group with a given name and size.
|
DebugGroup(java.lang.String name,
long n) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object o) |
java.lang.String |
formatCounterData()
Formats the count data for printing.
|
int |
getExponentiationWindowSize()
Returns the window size used for the non-cached precomputations computed during the exponentiation algorithm.
|
java.util.List<java.lang.Integer> |
getMultiExpTermNumbers()
Retrieves number of terms of each multi-exponentiation done.
|
GroupElement |
getNeutralElement()
Returns the neutral element for this group
|
long |
getNumExps()
Retrieves number of group exponentiations done.
|
long |
getNumInversionsNoExpMultiExp()
Retrieves number of group inversions not including ones done in (multi-)exponentiation algorithms.
|
long |
getNumInversionsTotal()
Retrieves number of group inversions including ones done in (multi-)exponentiation algorithms.
|
long |
getNumOpsNoExpMultiExp()
Retrieves number of group ops not including ones done in (multi-)exponentiation algorithms.
|
long |
getNumOpsTotal()
Retrieves number of group ops including ones done in (multi-)exponentiation algorithms.
|
long |
getNumRetrievedRepresentations()
Retrieves number of retrieved representations of group elements for this group (via getRepresentation()).
|
long |
getNumSquaringsNoExpMultiExp()
Retrieves number of group squarings not including ones done in (multi-)exponentiation algorithms.
|
long |
getNumSquaringsTotal()
Retrieves number of group squarings including ones done in (multi-)exponentiation algorithms.
|
int |
getPrecomputationWindowSize()
Returns the window size used for the precomputations.
|
Representation |
getRepresentation()
The representation of this object.
|
ExpAlgorithm |
getSelectedExpAlgorithm() |
MultiExpAlgorithm |
getSelectedMultiExpAlgorithm() |
GroupElement |
getUniformlyRandomElement()
Returns an element of this structure that is drawn uniformly at random
using a cryptographically strong RNG.
|
java.util.Optional<java.lang.Integer> |
getUniqueByteLength()
Returns the number of bytes returned by this structure's
UniqueByteRepresentable.getUniqueByteRepresentation(),
or an empty Optional if this structure's elements do not guarantee a fixed length. |
Zn |
getZn()
Returns
Zn, where n == size(). |
int |
hashCode() |
boolean |
isCommutative()
Returns true if this group is known to be commutative.
|
void |
resetCounters()
Resets all counters.
|
GroupElement |
restoreElement(Representation repr)
Creates an element of this structure from its representation.
|
void |
setExponentiationWindowSize(int exponentiationWindowSize)
Sets the window size used for used for the non-cached precomputations computed during the
exponentiation algorithm.
|
void |
setPrecomputationWindowSize(int precomputationWindowSize)
Sets the window size used for the cached precomputations.
|
void |
setSelectedExpAlgorithm(ExpAlgorithm selectedExpAlgorithm) |
void |
setSelectedMultiExpAlgorithm(MultiExpAlgorithm selectedMultiExpAlgorithm) |
java.math.BigInteger |
size()
Returns the number of elements in this structure (the size).
|
java.lang.String |
toString() |
DebugGroupElement |
wrap(Zn.ZnElement elem) |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitexpr, getGenerator, getUniformlyRandomElements, getUniformlyRandomExponent, getUniformlyRandomExponents, getUniformlyRandomNonNeutral, getUniformlyRandomNonNeutrals, getUniformlyRandomNonzeroExponent, getUniformlyRandomNonzeroExponents, getUniformlyRandomUnitExponent, getUniformlyRandomUnitExponents, restoreFromRepresentation, restoreVectorhasPrimeSizepublic DebugGroup(java.lang.String name,
java.math.BigInteger n)
name - the name of the groupn - the desired size of the grouppublic DebugGroup(java.lang.String name,
long n)
public DebugGroup(LazyGroup groupTotal, LazyGroup groupExpMultiExp)
DebugGroup with specific LazyGroup instances.
This can, for example, be used to change the choice of (multi-)exponentiation algorithm by configuring
the LazyGroup instances to use a different (multi-)exponentiation algorithm.public DebugGroup(Representation repr)
public GroupElement getNeutralElement()
GroupgetNeutralElement in interface Grouppublic java.math.BigInteger size()
throws java.lang.UnsupportedOperationException
Structurepublic GroupElement getUniformlyRandomElement() throws java.lang.UnsupportedOperationException
StructuregetUniformlyRandomElement in interface GroupgetUniformlyRandomElement in interface Structurejava.lang.UnsupportedOperationException - if the operation is not supportedpublic GroupElement restoreElement(Representation repr)
StructurerestoreElement in interface GrouprestoreElement in interface Structurerepr - the Representation returned by Representable.getRepresentation()public DebugGroupElement wrap(Zn.ZnElement elem)
public java.util.Optional<java.lang.Integer> getUniqueByteLength()
StructureUniqueByteRepresentable.getUniqueByteRepresentation(),
or an empty Optional if this structure's elements do not guarantee a fixed length.
For example, elements of Zp will always be represented by ceil(ceil(log(p))/8) bytes,
hence getUniqueByteLength() would return ceil(ceil(log(p))/8).
A polynomial ring would return an empty Optional since a polynomial's unique byte representation length
depends on its degree.
getUniqueByteLength in interface StructuregetUniqueByteRepresentation(),
or an empty Optional, if no guaranteepublic boolean isCommutative()
GroupisCommutative in interface Grouppublic Representation getRepresentation()
RepresentableReprUtilgetRepresentation in interface RepresentableRepresentationpublic long getNumSquaringsTotal()
public long getNumInversionsTotal()
public long getNumOpsTotal()
public long getNumSquaringsNoExpMultiExp()
public long getNumInversionsNoExpMultiExp()
public long getNumOpsNoExpMultiExp()
public long getNumExps()
public java.util.List<java.lang.Integer> getMultiExpTermNumbers()
public long getNumRetrievedRepresentations()
public void resetCounters()
public java.lang.String formatCounterData()
public int getExponentiationWindowSize()
public void setExponentiationWindowSize(int exponentiationWindowSize)
A larger window size leads to an exponential increase in the number of precomputations done during exponentiation. As the precomputations affected by this variable are only temporarily stored during execution of the exponentiation algorithm, we do not recommend setting this too high as the cost of computing the whole window quickly exceeds its performance benefits during the actual exponentiation.
If you want to change the number of cached precomputations, use this#setPrecomputationWindowSize(int).
public int getPrecomputationWindowSize()
public void setPrecomputationWindowSize(int precomputationWindowSize)
A larger window size leads to an exponential increase in the number of cached precomputations done but can also improve the performance of later exponentiations.
public MultiExpAlgorithm getSelectedMultiExpAlgorithm()
public void setSelectedMultiExpAlgorithm(MultiExpAlgorithm selectedMultiExpAlgorithm)
public ExpAlgorithm getSelectedExpAlgorithm()
public void setSelectedExpAlgorithm(ExpAlgorithm selectedExpAlgorithm)
public boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Object