示例#1
0
import sp800_22_tests
import compress_bin_files
from randomgen import Generator

instance_amnt = int(input("# of instances: "))
bits_per_instance = int(input("# of bits per instance: "))

sp800_22_tests.append_header("sp800_collected_cluster_data_xoroshiro.csv")

rnd = Generator()

for s in range(instance_amnt):
    print("----------------------  Iteration " + str(s) +
          "  ----------------------")
    bits = list(rnd.randint(low=0, high=2, size=bits_per_instance))
    sp800_22_tests.test_func(bits,
                             "sp800_collected_cluster_data_xoroshiro.csv",
                             'xoroshiro', s, False)
# compress_bin_files.compress("compression_ratio_cluster_data_xoroshiro.csv")
示例#2
0
import sp800_22_tests
import compress_bin_files
from randomgen import Generator, ThreeFry
instance_amnt = int(input("# of instances: "))
bits_per_instance = int(input("# of bits per instance: "))

sp800_22_tests.append_header("sp800_collected_cluster_data_threefry.csv")

rnd = Generator(ThreeFry())

for s in range(instance_amnt):
    print("----------------------  Iteration " + str(s) +
          "  ----------------------")
    bits = list(rnd.randint(low=0, high=2, size=bits_per_instance))
    sp800_22_tests.test_func(bits, "sp800_collected_cluster_data_threefry.csv",
                             "threefry", s)
# compress_bin_files.compress("compression_ratio_cluster_data_threefry.csv")
示例#3
0
import sp800_22_tests
import compress_bin_files
from randomgen import Generator, Philox
instance_amnt = int(input("# of instances: "))
bits_per_instance = int(input("# of bits per instance: "))

sp800_22_tests.append_header("sp800_collected_cluster_data_philox.csv")

rnd = Generator(Philox())

for s in range(instance_amnt):
    print("----------------------  Iteration " + str(s) +
          "  ----------------------")
    bits = list(rnd.randint(low=0, high=2, size=bits_per_instance))
    sp800_22_tests.test_func(bits, "sp800_collected_cluster_data_philox.csv",
                             "philox", s)
# compress_bin_files.compress("compression_ratio_cluster_data_philox.csv")
import sp800_22_tests
import arc4random
import time

instance_amnt = int(input("# of instances: "))
bits_per_instance = int(input("# of bits per instance: "))

sp800_22_tests.append_header("cluster_data_arc4random.csv")

for s in range(instance_amnt):
    print("----------------------  Iteration " + str(s) +
          "  ----------------------")
    bits = []
    start_time = time.time()
    for x in range(100):
        bits.append(arc4random.randsample(0, 1, int(bits_per_instance / 100)))
        print("Generating Bits: " + str(x))
    end = time.time()
    print("Duration: " + str(end - start_time))
    sp800_22_tests.test_func(bits, "cluster_data_arc4random.csv")
示例#5
0
import sp800_22_tests
import compress_bin_files
from randomgen import Generator, PCG64

instance_amnt = int(input("# of instances: "))
bits_per_instance = int(input("# of bits per instance: "))

sp800_22_tests.append_header("sp800_collected_cluster_data_PCG64.csv")

rnd = Generator(PCG64())

for s in range(instance_amnt):
    print("----------------------  Iteration " + str(s) +
          "  ----------------------")
    bits = list(rnd.randint(low=0, high=2, size=bits_per_instance))
    sp800_22_tests.test_func(bits, "sp800_collected_cluster_data_PCG64.csv",
                             "PCG64", s)

#obtain compression ratio for each

# compress_bin_files.compress("compression_ratio_cluster_data_PCG64.csv")
示例#6
0
import sys
import sp800_22_tests
import compress_bin_files
sys.path.append('/python')
import random

instance_amnt = int(input("# of instances: "))
bits_per_instance = int(input("# of bits per instance: "))

sp800_22_tests.append_header("sp800_collected_cluster_data_MTreee.csv")

for s in range(instance_amnt):
	print("----------------------  Iteration " + str(s) + "  ----------------------")
	bits = []
	for r in range(bits_per_instance):
	    bideath ts.append(random.randrange(0,2))


	sp800_22_tests.test_func(bits, "testing_overlap.csv", "MT", s, True)
# compress_bin_files.compress("compression_ratio_cluster_data_MT.csv")
示例#7
0
import sp800_22_tests
import random
from randomgen import RandomGenerator, Philox, ThreeFry


instance_amnt = int(input("# of instances for each: "))
bits_per_instance = int(input("# of bits per instance: "))

sp800_22_tests.append_header("cluster_data_combined_2.csv")

rndP = RandomGenerator(Philox())
rndX = RandomGenerator()
rndT = RandomGenerator(ThreeFry())

for s in range(instance_amnt):
	print("----------------------  Iteration " + str(s) + "  ----------------------")
	
	#Generating Random Numbers with each of the different PRNGs
	bitsP = list(rndP.randint(low=0, high=2, size=bits_per_instance))
	bitsX = list(rndX.randint(low=0, high=2, size=bits_per_instance))
	bitsT = list(rndT.randint(low=0, high=2, size=bits_per_instance))
	bitsM = []
	for r in range(bits_per_instance):
	    bitsM.append(random.randrange(0,2))
    
	#Running NIST suite tests on the generated data
	#IMPORTANT: the data in the csv is not organized in blocks: Instead, 
	#if x=entryNum%4, then x = 1 is Philox, x = 2 is Xorishiro,
	#x = 3 is ThreeFry, and x=4 is Mersenne Twister 
    print("--------  Philox " + str(s) +" --------")
	sp800_22_tests.test_func(bitsP, "cluster_data_combined_2.csv")