(一)下载
到NIST官网https://csrc.nist.gov/Projects/Random-Bit-Generation/Documentation-and-Software上下载源码:
目前最新版是sts-2.1.2,其中修改了重叠模板匹配和非重叠模板匹配的两个BUG,GitHub上大量对NIST STS的修改还没有更新这两处缺陷。
(二)编译
以Ubuntu 18.04下的编译为例,切换到根目录下,直接make:
make得到assess文件,直接执行:
1 |
./assess <datalength> |
datalength为测试样本的bit长度:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
hsm@ubuntu:~/Desktop/sts-2.1.2$ make make: 'assess' is up to date. hsm@ubuntu:~/Desktop/sts-2.1.2$ sudo ./assess 1048576 G E N E R A T O R S E L E C T I O N ______________________________________ [0] Input File [1] Linear Congruential [2] Quadratic Congruential I [3] Quadratic Congruential II [4] Cubic Congruential [5] XOR [6] Modular Exponentiation [7] Blum-Blum-Shub [8] Micali-Schnorr [9] G Using SHA-1 Enter Choice: 0 User Prescribed Input File: /home/hsm/Desktop/sts-2.1.2/Rand_1.bin S T A T I S T I C A L T E S T S _________________________________ [01] Frequency [02] Block Frequency [03] Cumulative Sums [04] Runs [05] Longest Run of Ones [06] Rank [07] Discrete Fourier Transform [08] Nonperiodic Template Matchings [09] Overlapping Template Matchings [10] Universal Statistical [11] Approximate Entropy [12] Random Excursions [13] Random Excursions Variant [14] Serial [15] Linear Complexity [16] GM-Pocker [17] GM-Runs Distribution [18] GM-Binary Derivative [19] GM-Autocorrelation INSTRUCTIONS Enter 0 if you DO NOT want to apply all of the statistical tests to each sequence and 1 if you DO. Enter Choice: 1 P a r a m e t e r A d j u s t m e n t s ----------------------------------------- [1] Block Frequency Test - block length(M): 100 [2] NonOverlapping Template Test - block length(m): 9 [3] Overlapping Template Test - block length(m): 9 [4] Approximate Entropy Test - block length(m): 5 [5] Serial Test - block length(m): 5 [6] Linear Complexity Test - block length(M): 500 Select Test (0 to continue): 0 How many bitstreams? 1 Input File Format: [0] ASCII - A sequence of ASCII 0's and 1's [1] Binary - Each byte in data file contains 8 bits of data Select input mode: 1 Statistical Testing In Progress......... Statistical Testing Complete!!!!!!!!!!!! |
转载时请保留出处,违法转载追究到底:进城务工人员小梅 » NIST STS随机数检测工具的使用