public class CountingBilinearMapImpl extends java.lang.Object implements BilinearMapImpl
BilinearMapImpl implementing a fast, but insecure pairing over Zn.
Allows for counting pairings.
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.
| Modifier and Type | Field and Description |
|---|---|
protected CountingGroupImpl |
g1
The groups underlying the bilinear group.
|
protected CountingGroupImpl |
g2
The groups underlying the bilinear group.
|
protected CountingGroupImpl |
gt
The groups underlying the bilinear group.
|
protected long |
numPairings
The counted number of pairings.
|
protected BilinearGroup.Type |
pairingType
The type of pairing this bilinear map offers.
|
protected java.math.BigInteger |
size
The order of the bilinear group.
|
protected Zn |
zn
Zn of order the bilinear group's size.
|
| Constructor and Description |
|---|
CountingBilinearMapImpl(BilinearGroup.Type type,
java.math.BigInteger groupSize,
boolean enableExpCounting,
boolean enableMultiExpCounting)
Instantiates this bilinear map with the given pairing type, group size, and counting configuration.
|
| Modifier and Type | Method and Description |
|---|---|
GroupElementImpl |
apply(GroupElementImpl g1,
GroupElementImpl g2)
Corresponds to
this.apply(g1, g2, 1). |
GroupElementImpl |
apply(GroupElementImpl g1,
GroupElementImpl g2,
java.math.BigInteger exponent)
Computes \(e(g1,g2)^\text{exponent}\).
|
boolean |
equals(java.lang.Object o) |
long |
getNumPairings()
Retrieves number of pairings computed in this bilinear group.
|
int |
hashCode() |
protected void |
incrementNumPairings()
Increments the pairing counter.
|
boolean |
isSymmetric()
Returns true if \(e(g,h) = e(h,g)\) for all g in G1, h in G2.
|
void |
resetNumPairings()
Resets pairing counter.
|
java.lang.String |
toString() |
protected CountingGroupImpl g1
protected CountingGroupImpl g2
protected CountingGroupImpl gt
protected Zn zn
protected java.math.BigInteger size
protected BilinearGroup.Type pairingType
protected long numPairings
public CountingBilinearMapImpl(BilinearGroup.Type type, java.math.BigInteger groupSize, boolean enableExpCounting, boolean enableMultiExpCounting)
type - type of the pairinggroupSize - size of g1, g2, and gt (number of group elements)enableExpCounting - if true, exponentiations in G1, G2 and GT are counted as a single unit
and group operations within exponentiations are not counted; otherwise the former is
not done and group operations within exponentiations are added to the total countenableMultiExpCounting - if true, number of terms in each multi-exponentiation is tracked and
group operations within multi-exponentiations are not counted; otherwise
the former is not done and group operations within multi-exponentiations
are added to the total countpublic GroupElementImpl apply(GroupElementImpl g1, GroupElementImpl g2, java.math.BigInteger exponent)
BilinearMapImpl
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 BilinearMapImplg1 - 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 GroupElementImpl apply(GroupElementImpl g1, GroupElementImpl g2)
BilinearMapImplthis.apply(g1, g2, 1).apply in interface java.util.function.BiFunction<GroupElementImpl,GroupElementImpl,GroupElementImpl>apply in interface BilinearMapImplg1 - left hand side argument for the pairing functiong2 - right hand side argument for the pairing functionpublic java.lang.String toString()
toString in class java.lang.Objectpublic boolean isSymmetric()
BilinearMapImplisSymmetric in interface BilinearMapImplpublic boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic long getNumPairings()
public void resetNumPairings()
protected void incrementNumPairings()