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(java.math.BigInteger groupSize,
BilinearGroup.Type pairingType)
Initializes this prime order bilinear group with the given size and pairing type.
|
DebugBilinearGroup(BilinearGroup.Type pairingType)
Initializes this prime order bilinear group with a random 256 bit size and the given pairing type.
|
DebugBilinearGroup(Representation repr) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object other) |
java.lang.String |
formatCounterData()
Formats the count data of the default bucket for printing.
|
java.lang.String |
formatCounterData(java.lang.String bucketName)
Formats the count data of the bucket with the given name for printing.
|
java.lang.String |
formatCounterDataAllBuckets()
Formats the count data of all buckets for printing.
|
java.lang.String |
formatCounterDataAllBuckets(boolean summaryOnly)
Formats the counter data of all buckets 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 from the default bucket
|
long |
getNumPairings(java.lang.String bucketName)
Returns the number of pairings computed in this bilinear group from the bucket with the given name.
|
long |
getNumPairingsAllBuckets()
Sums up the pairings across all buckets, including the default bucket.
|
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 the counters of the default bucket, including the ones in groups G1, G2, GT
as well as the pairing counter.
|
void |
resetCounters(java.lang.String bucketName)
Resets the counters of the bucket with the given name, including the ones in groups G1, G2, GT
as well as the pairing counter.
|
void |
resetCountersAllBuckets()
Resets counters of all buckets.
|
void |
resetNumPairings()
Resets pairing counter of the default bucket.
|
void |
resetNumPairings(java.lang.String bucketName)
Resets pairing counter of the bucket with the given name.
|
void |
resetNumPairingsAllBuckets()
Resets pairing counter of all buckets, including the default bucket.
|
void |
setBucket(java.lang.String name)
Sets the currently used operation count storage bucket to the one with the given name.
|
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(java.math.BigInteger groupSize,
BilinearGroup.Type pairingType)
groupSize - the size of the grouppairingType - 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 void setBucket(java.lang.String name)
The bucket is activated across G1, G2, and GT, as well as the pairing counter.
All operations executed after setting a bucket will be counted within that bucket only.
name - the name of the bucket to enablepublic long getNumPairings(java.lang.String bucketName)
public long getNumPairings()
public long getNumPairingsAllBuckets()
public void resetNumPairings(java.lang.String bucketName)
public void resetNumPairings()
public void resetNumPairingsAllBuckets()
public void resetCounters(java.lang.String bucketName)
public void resetCounters()
public void resetCountersAllBuckets()
public java.lang.String formatCounterData(java.lang.String bucketName)
bucketName - the name of the bucket whose data to format for printingpublic java.lang.String formatCounterData()
public java.lang.String formatCounterDataAllBuckets()
public java.lang.String formatCounterDataAllBuckets(boolean summaryOnly)
summaryOnly - if true, only formats the summed up results across all buckets; otherwise, outputs results
of every bucket plus the summarypublic 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 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)