Esempio n. 1
0
        )

    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_Sorted(verifyArgsDictRandomized,
                                           groupParamArg, verifyFuncArgs)
    incorrectSigIndices.sort()

    print(incorrectSigIndices)

    del incorrectSigIndices

    incorrectSigIndices = run_Ind(verifyArgsDictRandomized, groupParamArg,
                                  verifyFuncArgs)
    incorrectSigIndices.sort()

    print(incorrectSigIndices)
Esempio n. 2
0
	randomizedIndices = shuffle(preRandomizedIndices)

	if (preRandomizedIndices != []):
		sys.exit("Problems with randomly shuffling the valid and invalid signatures.")

	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_Sorted(verifyArgsDictRandomized, groupParamArg, verifyFuncArgs)
	incorrectSigIndices.sort()

	print(incorrectSigIndices)

	del incorrectSigIndices

	incorrectSigIndices = run_Ind(verifyArgsDictRandomized, groupParamArg, verifyFuncArgs)
	incorrectSigIndices.sort()

	print(incorrectSigIndices)
	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_Sorted(sigsDict, groupParamArg, verifyFuncArgs)
			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)
			endTime = time.clock()