stevenang / randomness_testsuite Goto Github PK
View Code? Open in Web Editor NEWThis is a Python implementation of NIST's A Statistical Test Suite for Random and Pseudorandom Number Generators for Cryptographic Applications
License: MIT License
This is a Python implementation of NIST's A Statistical Test Suite for Random and Pseudorandom Number Generators for Cryptographic Applications
License: MIT License
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.
im currently trying to use this on my laptop with a resolution of 1366x768 and i cant reach th lower tests and the other buttons.
save doesn't work because:
result = self.__test_result[0]
should be :
result = self._test_result[0]
just a minor typo
According to the NIST Standard 1 needs to be subtracted/added before the division.
This is not the case for following lines:
randomness_testsuite/CumulativeSum.py
Lines 54 to 55 in 7147879
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:
randomness_testsuite/CumulativeSum.py
Lines 62 to 63 in 7147879
this might be the correctio :
test = Universal()
binary_data = "your_binary_data_here"
p_value, result = test.statistical_test(binary_data, verbose=True)
print("Result of test:", result)
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.
Hi! You use function gammainc in your frequency test, but according to the NIST you must use "1 - gammainc"
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.
current
from scipy import zeros as zeros
after changes
from numpy import zeros as zeros
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);
It seems that from version scipy version v1.12.0rc1 ``scipy.zeros` was finally removed. This leads to an import error in RunTest.py
FIX: Use numpy.zeros instead.
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(acx(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
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
im currently trying to use this on a string file, and when i select and run all the tests it says that its finished, but the fields stay empty.
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.