Skip to content

Commit aee1e86

Browse files
committed
Added convenience constructor to Debug group
1 parent 3a8ab9b commit aee1e86

3 files changed

Lines changed: 13 additions & 5 deletions

File tree

src/main/java/org/cryptimeleon/math/structures/groups/debug/DebugBilinearGroup.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.cryptimeleon.math.structures.groups.debug;
22

3+
import org.cryptimeleon.math.random.RandomGenerator;
34
import org.cryptimeleon.math.serialization.Representation;
45
import org.cryptimeleon.math.serialization.annotations.ReprUtil;
56
import org.cryptimeleon.math.serialization.annotations.Represented;
@@ -88,6 +89,14 @@ public DebugBilinearGroup(BigInteger groupSize, BilinearGroup.Type pairingType)
8889
init();
8990
}
9091

92+
/**
93+
* Initializes this prime order bilinear group with a random 256 bit size and the given pairing type.
94+
* @param pairingType the type of pairing that should be offered by this bilinear group
95+
*/
96+
public DebugBilinearGroup(BilinearGroup.Type pairingType) {
97+
this(RandomGenerator.getRandomPrime(256), pairingType);
98+
}
99+
91100
public DebugBilinearGroup(Representation repr) {
92101
ReprUtil.deserialize(this, repr);
93102
init();

src/test/java/org/cryptimeleon/math/pairings/PairingTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,11 @@ public void testBasicProperties() {
8888
public static Collection<BilinearMap[]> data() {
8989
// Counting curves
9090
BilinearGroup countingGroup1 =
91-
new DebugBilinearGroup(RandomGenerator.getRandomPrime(128), BilinearGroup.Type.TYPE_1);
91+
new DebugBilinearGroup(BilinearGroup.Type.TYPE_1);
9292
BilinearGroup countingGroup2 =
93-
new DebugBilinearGroup(RandomGenerator.getRandomPrime(128), BilinearGroup.Type.TYPE_2);
93+
new DebugBilinearGroup(BilinearGroup.Type.TYPE_2);
9494
BilinearGroup countingGroup3 =
95-
new DebugBilinearGroup(RandomGenerator.getRandomPrime(128), BilinearGroup.Type.TYPE_3);
95+
new DebugBilinearGroup(BilinearGroup.Type.TYPE_3);
9696

9797
// Supersingular curve groups
9898
BilinearGroup supsingGroup = new SupersingularBasicBilinearGroup(80);

src/test/java/org/cryptimeleon/math/serialization/standalone/params/StructureStandaloneReprTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,7 @@ public void testLazyAndBasicGroup() {
8585
}
8686

8787
public void testDebugGroup() {
88-
testBilinearGroup(new DebugBilinearGroup(RandomGenerator.getRandomPrime(128),
89-
BilinearGroup.Type.TYPE_1));
88+
testBilinearGroup(new DebugBilinearGroup(BilinearGroup.Type.TYPE_1));
9089
testBilinearGroupImpl(new DebugBilinearGroupImpl(RandomGenerator.getRandomPrime(128),
9190
BilinearGroup.Type.TYPE_1, false));
9291
testBilinearGroupImpl(new DebugBilinearGroupImpl(RandomGenerator.getRandomPrime(128),

0 commit comments

Comments
 (0)