added randomization of tests.
package org.bouncycastle.pqc.crypto.test;
+import java.io.BufferedReader;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.HashMap;
+import java.util.Random;
+
import junit.framework.TestCase;
import org.bouncycastle.crypto.AsymmetricCipherKeyPair;
import org.bouncycastle.crypto.SecretWithEncapsulation;
-import org.bouncycastle.pqc.crypto.frodo.*;
+import org.bouncycastle.pqc.crypto.frodo.FrodoKEMExtractor;
+import org.bouncycastle.pqc.crypto.frodo.FrodoKEMGenerator;
+import org.bouncycastle.pqc.crypto.frodo.FrodoKeyGenerationParameters;
+import org.bouncycastle.pqc.crypto.frodo.FrodoKeyPairGenerator;
+import org.bouncycastle.pqc.crypto.frodo.FrodoParameters;
+import org.bouncycastle.pqc.crypto.frodo.FrodoPrivateKeyParameters;
+import org.bouncycastle.pqc.crypto.frodo.FrodoPublicKeyParameters;
import org.bouncycastle.util.Arrays;
import org.bouncycastle.util.encoders.Hex;
-import java.io.BufferedReader;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.util.HashMap;
public class FrodoVectorTest
extends TestCase
@@ -62,6 +70,7 @@ public void testVectors()
String line = null;
HashMap<String, String> buf = new HashMap<String, String>();
+ Random rnd = new Random(System.currentTimeMillis());
while ((line = bin.readLine()) != null)
{
line = line.trim();
@@ -75,6 +84,14 @@ public void testVectors()
if (buf.size() > 0)
{
String count = buf.get("count");
+ if (!"0".equals(count))
+ {
+ // randomly skip tests after zero.
+ if (rnd.nextBoolean())
+ {
+ continue;
+ }
+ }
System.out.println("test case: " + count);
byte[] seed = Hex.decode(buf.get("seed")); // seed for nist secure random
