public abstract class DebugGroupImpl extends java.lang.Object implements GroupImpl
| Modifier and Type | Field and Description |
|---|---|
protected java.lang.String |
name
Name of this group.
|
protected Zn |
zn
The Zn underlying this group.
|
| Constructor and Description |
|---|
DebugGroupImpl(Representation repr) |
DebugGroupImpl(java.lang.String name,
java.math.BigInteger n)
Instantiates this group with the given name and group size and to not count (multi-)exponentiations
explicitly (instead only total group operations are counted).
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object other) |
double |
estimateCostInvPerOp()
Estimates the number of inversions that can be done per group operation for the same cost.
|
GroupElementImpl |
getGenerator()
Returns any generator of this group if the group is cyclic and it's feasible to compute a generator.
|
GroupElementImpl |
getNeutralElement()
Returns the neutral element of this group.
|
Representation |
getRepresentation()
The representation of this object.
|
GroupElementImpl |
getUniformlyRandomElement()
Generates a uniformly random element of this group.
|
GroupElementImpl |
getUniformlyRandomNonNeutral()
Generates a uniformly random non-neutral element of this group.
|
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. |
int |
hashCode() |
boolean |
hasPrimeSize()
Returns true if the size of this structure is known and prime.
|
boolean |
isCommutative()
Returns true if this group is known to be commutative.
|
GroupElementImpl |
restoreElement(Representation repr)
Restores a group element from its representation.
|
java.math.BigInteger |
size()
Retrieves number of elements in the group if possible.
|
java.lang.String |
toString() |
DebugGroupElementImpl |
wrap(Zn.ZnElement elem)
Wraps a
ZnElement in a CountingGroupElementImpl belonging to this group. |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitexp, implementsOwnExp, implementsOwnMultiExp, multiexp, restoreFromRepresentationprotected java.lang.String name
CountingGroupElementImpl instances only allow for group
operations if the groups' names match.protected Zn zn
public DebugGroupImpl(java.lang.String name,
java.math.BigInteger n)
name - a unique name for this group. group operations are only compatible between groups of the same name
and nn - the size of this grouppublic DebugGroupImpl(Representation repr)
public Representation getRepresentation()
RepresentableReprUtilgetRepresentation in interface RepresentableRepresentationpublic GroupElementImpl getNeutralElement()
GroupImplgetNeutralElement in interface GroupImplpublic GroupElementImpl getUniformlyRandomElement() throws java.lang.UnsupportedOperationException
GroupImplgetUniformlyRandomElement in interface GroupImpljava.lang.UnsupportedOperationException - if the random generation cannot be donepublic GroupElementImpl getUniformlyRandomNonNeutral() throws java.lang.UnsupportedOperationException
GroupImplgetUniformlyRandomNonNeutral in interface GroupImpljava.lang.UnsupportedOperationException - if the random generation cannot be donepublic GroupElementImpl restoreElement(Representation repr)
GroupImplrestoreElement in interface GroupImplpublic GroupElementImpl getGenerator() throws java.lang.UnsupportedOperationException
GroupImplRepeated calls may or may not always supply the same generator again (i.e. the output is not guaranteed to be random)!
getGenerator in interface GroupImpljava.lang.UnsupportedOperationException - if group is not cyclic or it's too hard to compute a generatorpublic java.util.Optional<java.lang.Integer> getUniqueByteLength()
GroupImplUniqueByteRepresentable.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 GroupImplgetUniqueByteRepresentation(),
or an empty Optional, if no guaranteepublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object other)
equals in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic boolean isCommutative()
GroupImplisCommutative in interface GroupImplpublic java.math.BigInteger size()
throws java.lang.UnsupportedOperationException
GroupImplpublic boolean hasPrimeSize()
throws java.lang.UnsupportedOperationException
GroupImplhasPrimeSize in interface GroupImpljava.lang.UnsupportedOperationExceptionpublic DebugGroupElementImpl wrap(Zn.ZnElement elem)
ZnElement in a CountingGroupElementImpl belonging to this group.public double estimateCostInvPerOp()
GroupImpl2 would mean that an inversion costs half as much as a group operation, on average.estimateCostInvPerOp in interface GroupImpl