public interface GroupImpl extends StandaloneRepresentable, RepresentationRestorer
Usually wrapped by a Group to offer additional evaluation capabilities.
| Modifier and Type | Method and Description |
|---|---|
double |
estimateCostInvPerOp()
Estimates the number of inversions that can be done per group operation for the same cost.
|
default GroupElementImpl |
exp(GroupElementImpl base,
java.math.BigInteger exponent,
SmallExponentPrecomputation precomputation)
Can be overwritten to implement a custom exponentiation algorithm for the group.
|
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.
|
GroupElementImpl |
getUniformlyRandomElement()
Generates a uniformly random element of this group.
|
default 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. |
boolean |
hasPrimeSize()
Returns true if the size of this structure is known and prime.
|
default boolean |
implementsOwnExp()
Indicates whether this group implements its own custom exponentiation algorithm by overwriting
exp(org.cryptimeleon.math.structures.groups.GroupElementImpl, java.math.BigInteger, org.cryptimeleon.math.structures.groups.exp.SmallExponentPrecomputation). |
default boolean |
implementsOwnMultiExp()
Indicates whether this group implements its own multi-exponentiation algorithm
by overwriting
multiexp(Multiexponentiation). |
boolean |
isCommutative()
Returns true if this group is known to be commutative.
|
default GroupElementImpl |
multiexp(Multiexponentiation mexp)
Can be overwritten to implement a custom multi-exponentiation algorithm for the group.
|
GroupElementImpl |
restoreElement(Representation repr)
Restores a group element from its representation.
|
default GroupElementImpl |
restoreFromRepresentation(java.lang.reflect.Type type,
Representation repr)
Takes a representation and creates an object of the given type from it if the type is supported by the restorer.
|
java.math.BigInteger |
size()
Retrieves number of elements in the group if possible.
|
getRepresentationGroupElementImpl getNeutralElement()
GroupElementImpl getUniformlyRandomElement() throws java.lang.UnsupportedOperationException
java.lang.UnsupportedOperationException - if the random generation cannot be donedefault GroupElementImpl getUniformlyRandomNonNeutral() throws java.lang.UnsupportedOperationException
java.lang.UnsupportedOperationException - if the random generation cannot be doneGroupElementImpl restoreElement(Representation repr)
GroupElementImpl getGenerator() throws java.lang.UnsupportedOperationException
Repeated calls may or may not always supply the same generator again (i.e. the output is not guaranteed to be random)!
java.lang.UnsupportedOperationException - if group is not cyclic or it's too hard to compute a generatorboolean isCommutative()
java.math.BigInteger size()
throws java.lang.UnsupportedOperationException
java.lang.UnsupportedOperationException - if the number of elements is unknown or is too expensive to computeboolean hasPrimeSize()
default boolean implementsOwnExp()
exp(org.cryptimeleon.math.structures.groups.GroupElementImpl, java.math.BigInteger, org.cryptimeleon.math.structures.groups.exp.SmallExponentPrecomputation).exp(org.cryptimeleon.math.structures.groups.GroupElementImpl, java.math.BigInteger, org.cryptimeleon.math.structures.groups.exp.SmallExponentPrecomputation), else falsedefault GroupElementImpl exp(GroupElementImpl base, java.math.BigInteger exponent, SmallExponentPrecomputation precomputation)
base - the base of the exponentiationexponent - the exponent of the exponentiationprecomputation - a set of precomputations that can be used to speed up the exponentiationbase base to the power of exponentdefault boolean implementsOwnMultiExp()
multiexp(Multiexponentiation).default GroupElementImpl multiexp(Multiexponentiation mexp)
mexp - contains the multi-exponentiation termsdouble estimateCostInvPerOp()
2 would mean that an inversion costs half as much as a group operation, on average.default GroupElementImpl restoreFromRepresentation(java.lang.reflect.Type type, Representation repr)
RepresentationRestorerrestoreFromRepresentation in interface RepresentationRestorertype - tells the restorer which type the restored object should haverepr - the representation to restore the object fromjava.util.Optional<java.lang.Integer> getUniqueByteLength()
UniqueByteRepresentable.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.
getUniqueByteRepresentation(),
or an empty Optional, if no guarantee