Giter Club home page Giter Club logo

randomness_testsuite's Issues

Spectral Test - Different Results

Hello,

I noticed that for the spectral test, if I run your exact code I get a p-value of (0.08683884535014418, True) instead of the value in the results (0.847186705069) for data.e.

However, if I run with the data in results/20180107_Binary_Data.txt, I get the same value as in your results (p-value = 0.646355195539).

Do you have any idea why this may be happening?

Also, thank you for posting test result data. It's very helpful.

[Cumulative Sums Test] Add/Sub -1 after division instead of before leads to wrong result for test.

According to the NIST Standard 1 needs to be subtracted/added before the division.
Screenshot_2024-04-19_09-37-58

This is not the case for following lines:

start = int(floor(0.25 * floor(-length_of_binary_data / abs_max) + 1))
end = int(floor(0.25 * floor(length_of_binary_data / abs_max) - 1))

It should be:

start = int(floor(0.25 * floor(-length_of_binary_data / abs_max + 1)))
end = int(floor(0.25 * floor(length_of_binary_data / abs_max - 1)))

This is correct for the second sum though:

start = int(floor(0.25 * floor(-length_of_binary_data / abs_max - 3)))
end = int(floor(0.25 * floor(length_of_binary_data / abs_max) - 1))

Linux's /dev/urandom and Python's os.urandom does not pass

import os print( bin(int.from_bytes(os.urandom(1024),'big')))
does not pass Maurer test (09) and approx. Entropy test (12)
image

print( bin(int.from_bytes(open('/dev/urandom','rb').read(1024),'big'))) does not pass Maurer test (09) and randomly, does not pass approx. Entropy test (12) too

image
image

Test multiple sequences

Hello, thank you for your implementation, it has been of great help in my research.

I would like to know if it is possible to test multiple sequences in a single execution of the program, for example, I have 1000 binary sequences, and I want to know "Proportion of Sequences Passing a Test" and "Uniform Distribution of P-values" (As specified in the document from NIST). Can I do this in a single execution of the program, saving my sequences in a special file? Or do I have to do it by brute force, that is, test each sequence one by one?

Excuse my English, I am a Spanish speaker with little knowledge of the English language.

frequency test

Hi! You use function gammainc in your frequency test, but according to the NIST you must use "1 - gammainc"

Is there a reason why "NIST SP 800-22" is not referenced in README.md?

This project is very nice, but hard to find as it only mentions the title "NIST's A Statistical Test Suite for Random and Pseudorandom Number Generators for Cryptographic Applications" but not the document number "NIST SP 800-22". Is there a reason why?

Usually document numbers are pretty good search keywords for Google and similar search engines, so I would recommend to mention it in README.md file.

Testing random sequence from matlab

Hello @stevenang ! I want to check randomness in matlab with your NIST. I have a problem with generating txt and bin files as an input, I am not sure that it is exactly what is required. Could you help me?


y=randi(2,[1,2^4])-1

s = sprintf('%d', y);
fileID = fopen('test.txt','w');
fwrite(fileID,s);
fclose(fileID);

s = sprintf('%d', y);
fileID = fopen('test.bin','w');
fwrite(fileID,s);
fclose(fileID);

scipy.zeros removed

It seems that from version scipy version v1.12.0rc1 ``scipy.zeros` was finally removed. This leads to an import error in RunTest.py

grafik

FIX: Use numpy.zeros instead.

Input Data Problem

Hello** contributors, first of all thank you very much to provide us the coding process and a very helpful interface to calculate the NIST test. Dear Sir, I have doubt regarding the input because I want to test the randomness of the chaotic map in which firstly, we generate the random sequence by the chaotic map and then convert it into binary string like this

n = 1000;M=1032; m=9;
cx = zeros(1,n); cy = zeros(1,n); cz = zeros(1,n);
cx(1) = 0.121; cy(1) = 0.31; cz(1) = 0.18; b = 0.118; a= 2.72;
for j = 1 : n-1
cx(j+1) = cos(acx(j))sin(1/(cy(j)(1-cz(j))^2));
cy(j+1) = sin(a
cx(j)cy(j)+bcz(j));
cz(j+1) = cx(j);
end
Xx= abs(cx*10^6);

%%Convert the sequence to a binary sequence
for g = 1:1000
seq{1, g} = dec2bin(Xx(1, g));
data.txt

  • #end
    e = strrep(strjoin(seq), ' ', '');

**This is my MATLAB code to generate binary string from the chaotic map now I save the the output binary string into text file using Notepad and then in your interface when I choose input binary file and then execute the test it gives me very strange values of some tests like Approximate entropy test, Runs Test only Random excursion test pass. Can you explain me how can I use your interface to calculate the ### pvalues. @stevenang #13 @splch @ThexXTURBOXx

About data input size

Dear contributors,

First of all, thank you so much for providing this amazing tool and kindly share it as open source.

I have a bit string of approx 40 Kbit length. When I was using the tool, I found that the 'Maurer's Universal test' gave a very weird result of -1.0. I subsequently checked the source code and found this boils down to that you have limited the input length to 387 Kbit, as suggested in the NIST codebook.

This makes totally sense to me. However, my question will be that: why not add such length limitations on other tests as well? For example, I notice the suggested minimal length of Spectrum test is 1000 bit, but I didn't see such constraints in the source code. Will this make results of certain cases (i.e., short bit strings as input) invalid?

Thank you again for your contributions! Well done!

Best,
Mo

Different Results

First of all, thanks very much for such amazing program with intuitive UI.

I am using your program and I want to include it in my research paper I'm writing.

One thing is confusing me is that: there are many different versions of NIST Test Suite implementation in Python and each gives different results (drastically different and not different in a few decimals that don't affect the final conclusion/result). I am really concerned about the reliability.

For example: This famous NIST Test Suite in Python fails all PRNGs regardless, while yours seems more realistic (fails some and pass others).

Any suggestion, comment or advice?

Many Thanks,
Yahya.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.