Carries out a NIST SP800-90 health check and FIPS140-2 statistical tests on the random number generator.
Public Declare Function RNG_Test Lib "diCryptoSys.dll"
(ByVal strFileName As String) As Long
nRet = RNG_Test(strFileName)
long __stdcall RNG_Test(const char *szFileName);
If successful, the return value is 0; otherwise it returns a non-zero error code.
If the file specified in strFileName
does not exist, it will be created.
If it already exists, it will be overwritten without warning. If no directory path
is specified, the file will be created in the current default directory.
This function carries out, on demand, the health testing procedure from section 11.3 of
[SP80090A] and the statistical tests for randomness from
section 4.9.1 of the October 2001 version of FIPS-140-2 [FIPS140].
The statistical test results and the 20,000-bit sample are written to a text file.
Specify an empty (""
) or NULL szFileName to avoid creating an output file and just
carry out the tests. The statistical tests have since been removed from FIPS-140-2, but we do them anyway.
If any tests fail, a non-zero error code will be returned.
Dim nRet As Long nRet = RNG_Test("Fips140t.txt")
Will create the results file "Fips140t.txt" in the default directory. An example file is
FIPS140-2 test for 20000 bits (2500 bytes) at Sat Feb 15 18:28:30 2003 1. Monobits test n1 = 9909 (9725 - 10275) Passed Monobits test. 2. Poker test X = 19.69 (2.16 - 46.17) Passed Poker test. 3. Runs test: Run len: 1 2 3 4 5 6+ Gaps: 2507, 1236, 679, 319, 147, 147 Blocks: 2575, 1239, 633, 290, 138, 161 Min: (2315, 1114, 527, 240, 103, 103) Avg: (2500, 1250, 625, 312, 156, 156) Max: (2685, 1386, 723, 384, 209, 209) Pass: Y Y Y Y Y Y Passed Runs test. 4. Long runs test: Gmax = 17 Bmax = 11 (26) Passed Long Run test. Passed FIPS140-2 test. Test sample was:- BFB1EF06A74AB69698ED...
-