public class DebugBilinearGroup extends java.lang.Object implements BilinearGroup
BilinearGroup implementing a fast, but insecure pairing over Zn.
Allows for counting group operations and (multi-)exponentiations as well as pairings on the bilinear
group level.
The counting capability is implemented by wrapping two LazyBilinearGroups which contain
DebugBilinearGroupImpls themselves. All operations are executed in both groups,
one counts total group operations and one counts each (multi-)exponentiation as one unit.
This allows for tracking both kinds of data.
BilinearGroup.Type| Modifier and Type | Field and Description |
|---|---|
protected DebugBilinearMap |
bilMap
The underlying bilinear map used for applying the pairing function and counting it.
|
protected LazyBilinearGroup |
expMultiExpBilGroup
The bilinear group responsible for counting (multi-)exponentiations and group operations outside of those.
|
protected DebugGroup |
g1
The debug group for G1.
|
protected DebugGroup |
g2
The debug group for G2.
|
protected DebugGroup |
gT
The debug group for GT.
|
protected BilinearGroup.Type |
pairingType
The type of pairing this bilinear group should offer.
|
protected java.lang.Integer |
securityParameter
The security level offered by this bilinear group in number of bits.
|
protected LazyBilinearGroup |
totalBilGroup
The bilinear group responsible for counting total group operations.
|
| Constructor and Description |
|---|
DebugBilinearGroup(BilinearGroup.Type pairingType)
Initializes this prime order bilinear group of 128 bit size
|
DebugBilinearGroup(int securityParameter,
BilinearGroup.Type pairingType)
Initializes this bilinear group with the given security level, pairing type and prime group order.
|
DebugBilinearGroup(int securityParameter,
BilinearGroup.Type pairingType,
int numPrimeFactors)
Initializes this bilinear group with the given security level, pairing type, and group order factoring
into the given number of prime factors.
|
DebugBilinearGroup(Representation repr) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object other) |
java.lang.String |
formatCounterData()
Returns a string with all count data formatted for printing.
|
BilinearMap |
getBilinearMap()
Returns the
BilinearMap (contains the pairing operation) belonging to this BilinearGroup. |
int |
getExponentiationWindowSize()
Returns the window size used for the non-cached precomputations computed during the exponentiation algorithm
if G1, G2, and GT use the same one; otherwise -1.
|
Group |
getG1()
Returns the source group G1 associated with this bilinear group.
|
Group |
getG2()
Returns the source group G2 associated with this bilinear group.
|
Group |
getGT()
Returns the target group GT associated with this bilinear group.
|
HashIntoGroup |
getHashIntoG1()
Retrieves a hash function that maps byte arrays to G1.
|
HashIntoGroup |
getHashIntoG2()
Retrieves a hash function that maps byte arrays to G2.
|
HashIntoGroup |
getHashIntoGT()
Retrieves a hash function that maps byte arrays to GT.
|
GroupHomomorphism |
getHomomorphismG2toG1()
Retrieves the homomorphism from G2 to G1 if it exists.
|
long |
getNumPairings()
Returns the number of pairings computed in this bilinear group.
|
BilinearGroup.Type |
getPairingType() |
int |
getPrecomputationWindowSize()
Returns the window size used for the precomputations if G1, G2, and GT use the same one; otherwise -1.
|
Representation |
getRepresentation()
The representation of this object.
|
java.lang.Integer |
getSecurityLevel() |
ExpAlgorithm |
getSelectedExpAlgorithm()
Returns the selected exponentiation algorithm if G1, G2, and GT use the same one; otherwise null.
|
MultiExpAlgorithm |
getSelectedMultiExpAlgorithm()
Returns the selected multi-exponentiation algorithm if G1, G2, and GT use the same one; otherwise null.
|
int |
hashCode() |
protected void |
init()
Initializes the internal debug objects.
|
void |
resetCounters()
Resets all counters, including the ones in groups G1, G2, GT.
|
void |
resetNumPairings()
Resets pairing counter.
|
void |
setExponentiationWindowSize(int exponentiationWindowSize)
Sets the window size used for used for the non-cached precomputations computed during the
exponentiation algorithm for G1, G2, and GT at once.
|
void |
setPrecomputationWindowSize(int precomputationWindowSize)
Sets the window size used for the cached precomputations for G1, G2, and GT at once.
|
void |
setSelectedExpAlgorithm(ExpAlgorithm selectedExpAlgorithm)
Sets the exponentiation algorithm used for G1, G2, and GT at once.
|
void |
setSelectedMultiExpAlgorithm(MultiExpAlgorithm selectedMultiExpAlgorithm)
Sets the multi-exponentiation algorithm used for G1, G2, and GT at once.
|
java.lang.String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitgetHashIntoZGroupExponent, getZn, sizeprotected java.lang.Integer securityParameter
protected BilinearGroup.Type pairingType
protected LazyBilinearGroup totalBilGroup
protected LazyBilinearGroup expMultiExpBilGroup
protected DebugBilinearMap bilMap
protected DebugGroup g1
protected DebugGroup g2
protected DebugGroup gT
public DebugBilinearGroup(int securityParameter,
BilinearGroup.Type pairingType,
int numPrimeFactors)
securityParameter - the security level in number of bitspairingType - the type of pairing that should be offered by this bilinear groupnumPrimeFactors - the number of prime factors the group order should havepublic DebugBilinearGroup(int securityParameter,
BilinearGroup.Type pairingType)
securityParameter - the security level in number of bitspairingType - the type of pairing that should be offered by this bilinear grouppublic DebugBilinearGroup(BilinearGroup.Type pairingType)
pairingType - the type of pairing that should be offered by this bilinear grouppublic DebugBilinearGroup(Representation repr)
protected void init()
public Group getG1()
BilinearGroupgetG1 in interface BilinearGrouppublic Group getG2()
BilinearGroupgetG2 in interface BilinearGrouppublic Group getGT()
BilinearGroupgetGT in interface BilinearGrouppublic BilinearMap getBilinearMap()
BilinearGroupBilinearMap (contains the pairing operation) belonging to this BilinearGroup.getBilinearMap in interface BilinearGrouppublic GroupHomomorphism getHomomorphismG2toG1() throws java.lang.UnsupportedOperationException
BilinearGroupgetHomomorphismG2toG1 in interface BilinearGroupjava.lang.UnsupportedOperationException - if no such homomorphism exists or the bilinear group is not configured
to support such functionalitypublic HashIntoGroup getHashIntoG1() throws java.lang.UnsupportedOperationException
BilinearGroupgetHashIntoG1 in interface BilinearGroupjava.lang.UnsupportedOperationException - if no such hash function exists or the bilinear group is not configured
to support such functionalitypublic HashIntoGroup getHashIntoG2() throws java.lang.UnsupportedOperationException
BilinearGroupgetHashIntoG2 in interface BilinearGroupjava.lang.UnsupportedOperationException - if no such hash function exists or the bilinear group is not configured
to support such functionalitypublic HashIntoGroup getHashIntoGT() throws java.lang.UnsupportedOperationException
BilinearGroupgetHashIntoGT in interface BilinearGroupjava.lang.UnsupportedOperationException - if no such hash function exists or the bilinear group is not configured
to support such functionalitypublic java.lang.Integer getSecurityLevel()
getSecurityLevel in interface BilinearGrouppublic BilinearGroup.Type getPairingType()
getPairingType in interface BilinearGrouppublic Representation getRepresentation()
RepresentableReprUtilgetRepresentation in interface RepresentableRepresentationpublic boolean equals(java.lang.Object other)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic long getNumPairings()
public void resetNumPairings()
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)