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")
Beispiel #2
0
from zipfile import ZipFile
import sys

sys.path.append('..')
sys.path.append('../python')

import sp800_22_tests

pathZ = "/Volumes/NO NAME/Tamir Research/raw_zip_files/MT/MT_iteration_"

for idx in range(475, 1000):
    print("Iteration " + str(idx))
    with ZipFile(str(pathZ) + str(idx) + ".zip", 'r') as zip:
        archiveList = zip.namelist()
        archivePath = archiveList[0]

        data = zip.read(archivePath)
        data = data[:-1]
        data = data.decode('utf-8')

        data_array = data.split(",")
        data_array_int = [int(numeric_string) for numeric_string in data_array]
        sp800_22_tests.test_func(data_array_int,
                                 "sp800_collected_cluster_data_MT_fix.csv",
                                 'MT', idx, True)
Beispiel #3
0
from zipfile import ZipFile
import sys

sys.path.append('..')
sys.path.append('../python')

import sp800_22_tests

pathZ = "/Volumes/NO NAME/Tamir Research/raw_zip_files/MT/MT_iteration_"

for idx in range(948, 1000):
    print("Iteration " + str(idx))
    with ZipFile(str(pathZ) + str(idx) + ".zip", 'r') as zip:
        archiveList = zip.namelist()
        archivePath = archiveList[0]

        data = zip.read(archivePath)
        data = data[:-1]
        data = data.decode('utf-8')

        data_array = data.split(",")
        data_array_int = [int(numeric_string) for numeric_string in data_array]
        sp800_22_tests.test_func(
            data_array_int, "sp800_collected_cluster_data_xoroshiro_fix.csv",
            'xoroshiro', idx, True)
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")
Beispiel #5
0
from zipfile import ZipFile
import sys

sys.path.append('..')
sys.path.append('../python')

import sp800_22_tests

pathZ = "/Volumes/NO NAME/Tamir Research/raw_zip_files/philox/philox_iteration_"

for idx in range(358, 1000):
    print("Iteration " + str(idx))
    with ZipFile(str(pathZ) + str(idx) + ".zip", 'r') as zip:
        archiveList = zip.namelist()
        archivePath = archiveList[0]

        data = zip.read(archivePath)
        data = data[:-1]
        data = data.decode('utf-8')

        data_array = data.split(",")
        data_array_int = [int(numeric_string) for numeric_string in data_array]
        sp800_22_tests.test_func(
            data_array_int, "sp800_collected_cluster_data_philox_fix.csv",
            'threefry', idx, True)
Beispiel #6
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")
Beispiel #7
0
    series = series + [next]
    #Then generate the remaining pseudorandom numbers with LCG.
    for n in range(0, size - 1):
        next = (series[n] * multiplier + increment) % modulus
        series = series + [next]
    #Adjust the numbers to account for the range specified.
    limit_divisor = modulus / limits[1]
    for i in range(0, len(series)):
        series[i] = series[i] / limit_divisor
    #Check the integer parameter
    if int_param:
        if size == 1:
            return int(series[0])
        intify = lambda a: int(a)
        return map(intify, series)
    else:
        if size == 1:
            return series[0]
        return series


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

sp800_22_tests.append_header("sp800_collected_cluster_data_LCG.csv")

for s in range(instance_amnt):
    bits = LCG(size=bits_per_instance)
    sp800_22_tests.test_func(bits, "sp800_collected_cluster_data_LCG.csv")
compress_bin_files.compress("compression_ratio_cluster_data_LCG.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")
Beispiel #9
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")
Beispiel #10
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")
Beispiel #11
0
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")
	print("--------  Xoroshiro " + str(s) +" --------")
	sp800_22_tests.test_func(bitsX, "cluster_data_combined_2.csv")
	print("--------  ThreeFry " + str(s) +" --------")
	sp800_22_tests.test_func(bitsT, "cluster_data_combined_2.csv")
	print("--------  Mersenne Twister " + str(s) +" --------")
	sp800_22_tests.test_func(bitsM, "cluster_data_combined_2.csv")