public class DebugBilinearMap extends java.lang.Object implements BilinearMap
BilinearMap 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 bilinear map works by mapping (Zn,+) x (Zn,+) to (Zn,+) via (a,b) -> a*b
(multiplication in Zn).
It is insecure since DLOG is trivial in Zn.
The counting capability is implemented by wrapping two LazyBilinearMaps 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.
DebugBilinearGroup| Constructor and Description |
|---|
DebugBilinearMap(LazyBilinearMap bilMapTotal,
LazyBilinearMap bilMapNoExpMultiExp) |
| Modifier and Type | Method and Description |
|---|---|
GroupElement |
apply(GroupElement g1,
GroupElement g2)
Corresponds to
this.apply(g1, g2, 1). |
GroupElement |
apply(GroupElement g1,
GroupElement g2,
java.math.BigInteger exponent)
Computes \(e(g1,g2)^\text{exponent}\).
|
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.
|
Group |
getG1()
Returns the source group G1 associated with this bilinear map.
|
Group |
getG2()
Returns the source group G2 associated with this bilinear map.
|
Group |
getGT()
Returns the target group GT associated with this bilinear map.
|
long |
getNumPairings()
Retrieves number of parings computed in this bilinear group from the default bucket.
|
long |
getNumPairings(java.lang.String bucketName)
Retrieves number of pairings computed in this bilinear group from the bucket with the given name.
|
long |
getNumPairingsAllBuckets()
Sums up pairings across all buckets, including default bucket.
|
int |
hashCode() |
boolean |
isSymmetric()
Returns true if
e(g,h).equals(e(h,g)) for all g, h. |
void |
resetNumPairings()
Resets pairing counter for the default bucket.
|
void |
resetNumPairings(java.lang.String bucketName)
Resets pairing counter for the bucket with the given name.
|
void |
resetNumPairingsAllBuckets()
Resets pairing counter for all buckets.
|
void |
setBucket(java.lang.String name)
Sets the currently used operation count storage bucket to the one with the given name.
|
void |
setDefaultBucket()
Activates the default bucket.
|
java.lang.String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitapply, apply, applyExpr, applyExpr, applyExpr, applyExpr, innerProductpublic DebugBilinearMap(LazyBilinearMap bilMapTotal, LazyBilinearMap bilMapNoExpMultiExp)
public Group getG1()
BilinearMapgetG1 in interface BilinearMappublic Group getG2()
BilinearMapgetG2 in interface BilinearMappublic Group getGT()
BilinearMapgetGT in interface BilinearMappublic GroupElement apply(GroupElement g1, GroupElement g2, java.math.BigInteger exponent)
BilinearMap
Depending on the bilinear map and the involved groups, this may be more efficiently implemented than computing
it directly via apply(g1,g2).pow(exponent).
For example, implementations should do exponentiation in the group with the cheapest group operation.
apply in interface BilinearMapg1 - left hand side argument for the pairing functiong2 - right hand side argument for the pairing functionexponent - the exponent to apply to the result of the pairingpublic GroupElement apply(GroupElement g1, GroupElement g2)
BilinearMapthis.apply(g1, g2, 1).apply in interface java.util.function.BiFunction<GroupElement,GroupElement,GroupElement>apply in interface BilinearMapg1 - left hand side argument for the pairing functiong2 - right hand side argument for the pairing functionpublic boolean isSymmetric()
BilinearMape(g,h).equals(e(h,g)) for all g, h.isSymmetric in interface BilinearMappublic boolean equals(java.lang.Object other)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic void setBucket(java.lang.String name)
All operations executed after setting a bucket will be counted within that bucket only.
name - the name of the bucket to enablepublic void setDefaultBucket()
public long getNumPairings(java.lang.String bucketName)
bucketName - the name of the bucket to obtain pairing numbers frompublic long getNumPairings()
public long getNumPairingsAllBuckets()
public void resetNumPairings(java.lang.String bucketName)
bucketName - the name of the bucket to reset pairing counter forpublic void resetNumPairings()
public void resetNumPairingsAllBuckets()
public java.lang.String toString()
toString in class java.lang.Objectpublic 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()
this#formatCounterDataAllBuckets(boolean)public java.lang.String formatCounterDataAllBuckets(boolean summaryOnly)
The summed up results are added at the end.
summaryOnly - if true, only formats the summed up results across all buckets; otherwise, outputs results
of every bucket plus the summarythis#formatCounterDataAllBuckets()