diff --git a/Tets_Python/Main.py b/Tets_Python/Main.py index d22cae3..994fc83 100644 --- a/Tets_Python/Main.py +++ b/Tets_Python/Main.py @@ -17,41 +17,50 @@ if __name__ == "__main__": with open(filename, "rb") as f: binary_data2 = f.read().strip() - # Call the StarUpTest +# Example byte sequence representing binary data + byte_data = bytes([0b11010001, 0b11000010, 0b11010100, 0b00110110, 0b10010100, 0b11100100, 0b10111111, 0b01000010, 0b01100011, 0b00111000, 0b00100110, 0b10001110, 0b11101000, 0b11100100, 0b10000001, 0b10011011, 0b01111011, 0b11101001, 0b00011010, 0b01001110, 0b00001111, 0b01000010, 0b11111001, 0b10110100, 0b10100000, 0b11101001, 0b00001100, 0b11001011, 0b11101100, 0b01101111, 0b10111000, 0b10010110, 0b11000101, 0b01000101, 0b10101011, 0b01001001, 0b00001100, 0b10010001, 0b11000100, 0b00101000, 0b11010101, 0b10001111, 0b00001000, 0b11000011, 0b10111110, 0b11110111, 0b01001110, 0b11100010, 0b10100000, 0b00001110, 0b00100101, 0b01111111, 0b01111010, 0b10101110, 0b10010110, 0b10101101, 0b01101110, 0b01010011, 0b10000100, 0b00011001, 0b01101110, 0b11000100, 0b11100010]) + print(byte_data) + +# Call the StarUpTest print("StartUp:") - result = StartUPTest.monobit_test(binary_data2) + result = StartUPTest.monobit_test(byte_data) print("p_value:", result[0]) print("test passed (p_value >= 0.01):", result[1]) - result = StartUPTest.autocorrelation_test(binary_data2) - print("Z_tau:", result[0]) - print("test passed (Z_tau > 2326 and Z_tau < 2674):", result[1]) +# result = StartUPTest.autocorrelation_test(binary_data2) +# print("Z_tau:", result[0]) +# print("test passed (Z_tau > 2326 and Z_tau < 2674):", result[1]) + + result = StartUPTest.chi_square(byte_data) + print("p_value:", result[0]) + print("test passed (p_value >= 0.01):", result[1]) + print("Chi2_statistic", result[2]) # Call the TotalFailure-Test print("Total Failure:") - result = TotOnline.total_failure_test(binary_data, pattern_length=10) + result = TotOnline.total_failure_test(byte_data, pattern_length=10) print("p_value:", result[0]) print("test passed (p_value >= 0.01):", result[1]) # Call the Online Test print("Monobit:") - result = TotOnline.monobit_test(binary_data) + result = TotOnline.monobit_test(byte_data) print("p_value:", result[0]) print("test passed (p_value >= 0.01):", result[1]) print("Block Frequency:") - result = TotOnline.block_frequency_test(binary_data) + result = TotOnline.block_frequency_test(byte_data) print("p_value:", result[0]) print("test passed (p_value >= 0.01):", result[1]) print("Run:") - result = TotOnline.run_test(binary_data) + result = TotOnline.run_test(byte_data) print("p_value:", result[0]) print("test passed (p_value >= 0.01):", result[1]) print("Longest Run:") - result = TotOnline.longest_one_block_test(binary_data) + result = TotOnline.longest_one_block_test(byte_data) print("p_value:", result[0]) print("test passed (p_value >= 0.01):", result[1])