public class CountingGroup extends java.lang.Object implements Group
This counting capability is realized by using two LazyGroups that each wrap a CountingGroupImpl.
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 |
|---|
CountingGroup(LazyGroup groupTotal,
LazyGroup groupExpMultiExp)
This constructor allows instantiating the
CountingGroup with specific LazyGroup instances. |
CountingGroup(Representation repr) |
CountingGroup(java.lang.String name,
java.math.BigInteger n)
Initializes the counting group with a given name and size.
|
CountingGroup(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.
|
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.
|
Representation |
getRepresentation()
The representation of this object.
|
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.
|
java.math.BigInteger |
size()
Returns the number of elements in this structure (the size).
|
java.lang.String |
toString() |
CountingGroupElement |
wrap(Zn.ZnElement elem) |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitexpr, getGenerator, getUniformlyRandomElements, getUniformlyRandomExponent, getUniformlyRandomExponents, getUniformlyRandomNonNeutral, getUniformlyRandomNonNeutrals, getUniformlyRandomNonzeroExponent, getUniformlyRandomNonzeroExponents, getUniformlyRandomUnitExponent, getUniformlyRandomUnitExponents, restoreFromRepresentation, restoreVectorhasPrimeSizepublic CountingGroup(java.lang.String name,
java.math.BigInteger n)
name - the name of the groupn - the desired size of the grouppublic CountingGroup(java.lang.String name,
long n)
public CountingGroup(LazyGroup groupTotal, LazyGroup groupExpMultiExp)
CountingGroup 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 CountingGroup(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 CountingGroupElement 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 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