indOutputFile = open(indResultsFile, 'w') for programIteration in range(0, NUM_PROGRAM_ITERATIONS): #print("program iteration ", programIteration) for cycle in range(0, NUM_CYCLES): #print("\tcycle number ", cycle) sigsDict = {} loadDataFromDictInMemory(validDict, 0, (cycle + 1), sigsDict, 0) verifyFuncArgs = list(sigsDict[0].keys()) startTime = time.clock() incorrectSigIndices = run_Batch(sigsDict, groupParamArg, verifyFuncArgs, False) endTime = time.clock() result = (endTime - startTime) * time_in_ms if (incorrectSigIndices != []): print(incorrectSigIndices) sys.exit("Batch verification returned invalid signatures.") batchResultsTimes = (float(result) / float(cycle + 1)) currentBatchOutputString = str(batchResultsTimes) + "," batchOutputFile.write(currentBatchOutputString) startTime = time.clock() incorrectSigIndices = run_Ind(sigsDict, groupParamArg, verifyFuncArgs)
verifyArgsDictRandomized = {} randomizedIncorrectSigIndices = [] for sigIndex in range(0, 20): verifyArgsDictRandomized[sigIndex] = sigsDict[ randomizedIndices[sigIndex]] if (randomizedIndices[sigIndex] in realIncorrectSigIndices): randomizedIncorrectSigIndices.append(sigIndex) randomizedIncorrectSigIndices.sort() print(randomizedIncorrectSigIndices) verifyFuncArgs = list(verifyArgsDictRandomized[0].keys()) incorrectSigIndices = run_Batch(verifyArgsDictRandomized, groupParamArg, verifyFuncArgs, True) incorrectSigIndices.sort() print(incorrectSigIndices) ''' if (areListsEqual(randomizedIncorrectSigIndices, incorrectSigIndices) == False): sys.exit("Error: batch code returned wrong results for which signatures are invalid.") if (len(incorrectSigIndices) != 10): sys.exit("Error: batch code returned wrong results for number of invalid signatures.") ''' del incorrectSigIndices incorrectSigIndices = run_Ind(verifyArgsDictRandomized, groupParamArg, verifyFuncArgs)
indResultsTimes[initIndex] = {} for programIteration in range(0, NUM_PROGRAM_ITERATIONS): print("program iteration ", programIteration) for cycle in range(0, NUM_CYCLES): #print("cycle is ", cycle) sigsDict = {} loadDataFromDictInMemory(validDict, 0, (cycle+1), sigsDict, 0) verifyFuncArgs = list(sigsDict[0].keys()) startTime = time.clock() incorrectSigIndices = run_Batch(sigsDict, groupParamArg, verifyFuncArgs, False) endTime = time.clock() result = (endTime - startTime) * time_in_ms #print("batch is ", result) if (incorrectSigIndices != []): sys.exit("Batch verification returned invalid signatures.") batchResultsTimes[programIteration][cycle] = ( float(result) / float(cycle+1) ) startTime = time.clock() incorrectSigIndices = run_Ind(sigsDict, groupParamArg, verifyFuncArgs) endTime = time.clock()
verifyArgsDictRandomized = {} randomizedIncorrectSigIndices = [] for sigIndex in range(0, 20): verifyArgsDictRandomized[sigIndex] = sigsDict[randomizedIndices[sigIndex]] if (randomizedIndices[sigIndex] in realIncorrectSigIndices): randomizedIncorrectSigIndices.append(sigIndex) randomizedIncorrectSigIndices.sort() print(randomizedIncorrectSigIndices) verifyFuncArgs = list(verifyArgsDictRandomized[0].keys()) incorrectSigIndices = run_Batch(verifyArgsDictRandomized, groupParamArg, verifyFuncArgs, True) incorrectSigIndices.sort() print(incorrectSigIndices) ''' if (areListsEqual(randomizedIncorrectSigIndices, incorrectSigIndices) == False): sys.exit("Error: batch code returned wrong results for which signatures are invalid.") if (len(incorrectSigIndices) != 10): sys.exit("Error: batch code returned wrong results for number of invalid signatures.") ''' del incorrectSigIndices incorrectSigIndices = run_Ind(verifyArgsDictRandomized, groupParamArg, verifyFuncArgs)