资源简介
这是一个NIST随机数静态测试包,可以用它来测试你自己设计的为随机数生成算法是否满足一定的密码学强度。
代码片段和文件信息
#include
#include
#include
#include
#include “../include/externs.h“
#include “../include/utilities.h“
#include “../include/cephes.h“
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
A P P R O X I M A T E E N T R O P Y T E S T
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
void
ApproximateEntropy(int m int n)
{
int i j k r blockSize seqLength powLen index;
double sum numOfBlocks ApEn[2] apen chi_squared p_value;
unsigned int *P;
fprintf(stats[TEST_APEN] “\t\t\tAPPROXIMATE ENTROPY TEST\n“);
fprintf(stats[TEST_APEN] “\t\t--------------------------------------------\n“);
fprintf(stats[TEST_APEN] “\t\tCOMPUTATIONAL INFORMATION:\n“);
fprintf(stats[TEST_APEN] “\t\t--------------------------------------------\n“);
fprintf(stats[TEST_APEN] “\t\t(a) m (block length) = %d\n“ m);
seqLength = n;
r = 0;
for ( blockSize=m; blockSize<=m+1; blockSize++ ) {
if ( blockSize == 0 ) {
ApEn[0] = 0.00;
r++;
}
else {
numOfBlocks = (double)seqLength;
powLen = (int)pow(2 blockSize+1)-1;
if ( (P = (unsigned int*)calloc(powLensizeof(unsigned int)))== NULL ) {
fprintf(stats[TEST_APEN] “ApEn: Insufficient memory available.\n“);
return;
}
for ( i=1; i P[i] = 0;
for ( i=0; i k = 1;
for ( j=0; j k <<= 1;
if ( (int)epsilon[(i+j) % seqLength] == 1 )
k++;
}
P[k-1]++;
}
/* DISPLAY FREQUENCY */
sum = 0.0;
index = (int)pow(2 blockSize)-1;
for ( i=0; i<(int)pow(2 blockSize); i++ ) {
if ( P[index] > 0 )
sum += P[index]*log(P[index]/numOfBlocks);
index++;
}
sum /= numOfBlocks;
ApEn[r] = sum;
r++;
free(P);
}
}
apen = ApEn[0] - ApEn[1];
chi_squared = 2.0*seqLength*(log(2) - apen);
p_value = cephes_igamc(pow(2 m-1) chi_squared/2.0);
fprintf(stats[TEST_APEN] “\t\t(b) n (sequence length) = %d\n“ seqLength);
fprintf(stats[TEST_APEN] “\t\t(c) Chi^2 = %f\n“ chi_squared);
fprintf(stats[TEST_APEN] “\t\t(d) Phi(m) = %f\n“ ApEn[0]);
fprintf(stats[TEST_APEN] “\t\t(e) Phi(m+1) = %f\n“ ApEn[1]);
fprintf(stats[TEST_APEN] “\t\t(f) ApEn = %f\n“ apen);
fprintf(stats[TEST_APEN] “\t\t(g) Log(2) = %f\n“ log(2.0));
fprintf(stats[TEST_APEN] “\t\t--------------------------------------------\n“);
if ( m > (int)(log(seqLength)/log(2)-5) ) {
fprintf(stats[TEST_APEN] “\t\tNote: The blockSize = %d exceeds recommended value of %d\n“ m
MAX(1 (int)(log(seqLength)/log(2)-5)));
fprintf(stats[TEST_APEN] “\t\tResults are inaccurate!\n“);
fprintf(stats[TEST_APEN] “\t\t--------------------------------------------\n“);
}
fprintf(stats[TEST_APEN] “%s\t\tp_value = %f\n\n“ p_value < ALPHA ? “FAILURE“ : “SUCCESS“ p_value); fflush(stats[TEST_APEN]);
fprint
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
....... 37500000 2000-04-13 09:36 sts-2.1.2\sts-2.1.2\data\BBS.dat
....... 1572864 2000-03-02 09:31 sts-2.1.2\sts-2.1.2\data\data.bad_rng
....... 1165666 1998-03-25 13:39 sts-2.1.2\sts-2.1.2\data\data.e
....... 1165666 1998-03-25 13:39 sts-2.1.2\sts-2.1.2\data\data.pi
....... 125000 1999-06-10 13:08 sts-2.1.2\sts-2.1.2\data\data.sha1
....... 1165667 1998-03-25 13:39 sts-2.1.2\sts-2.1.2\data\data.sqrt2
....... 1165667 1998-03-25 13:39 sts-2.1.2\sts-2.1.2\data\data.sqrt3
....... 526 2008-04-28 13:31 sts-2.1.2\sts-2.1.2\experiments\create-dir-sc
....... 388 2008-03-20 22:49 sts-2.1.2\sts-2.1.2\include\cephes.h
....... 806 2008-05-06 10:41 sts-2.1.2\sts-2.1.2\include\config.h
....... 989 2008-05-09 11:21 sts-2.1.2\sts-2.1.2\include\decls.h
....... 2340 2008-06-23 13:26 sts-2.1.2\sts-2.1.2\include\defs.h
....... 691 2008-05-09 11:22 sts-2.1.2\sts-2.1.2\include\externs.h
....... 1728 2008-04-25 12:26 sts-2.1.2\sts-2.1.2\include\generators.h
....... 1563 2008-04-28 15:25 sts-2.1.2\sts-2.1.2\include\genutils.h
....... 786 2008-04-25 10:27 sts-2.1.2\sts-2.1.2\include\matrix.h
....... 720 2008-04-25 14:03 sts-2.1.2\sts-2.1.2\include\stat_fncs.h
....... 709 2008-04-28 10:30 sts-2.1.2\sts-2.1.2\include\utilities.h
....... 3657 2008-06-18 12:50 sts-2.1.2\sts-2.1.2\makefile
....... 3069 2009-09-02 20:43 sts-2.1.2\sts-2.1.2\src\approximateEntropy.c
....... 1754 2009-09-02 20:44 sts-2.1.2\sts-2.1.2\src\blockFrequency.c
....... 5834 2008-06-19 12:54 sts-2.1.2\sts-2.1.2\src\cephes.c
....... 2919 2009-09-02 20:46 sts-2.1.2\sts-2.1.2\src\cusum.c
....... 25517 2008-10-31 08:18 sts-2.1.2\sts-2.1.2\src\dfft.c
....... 2525 2014-07-08 10:51 sts-2.1.2\sts-2.1.2\src\discreteFourierTransform.c
....... 1319 2009-09-02 20:49 sts-2.1.2\sts-2.1.2\src\frequency.c
....... 12629 2010-01-27 09:41 sts-2.1.2\sts-2.1.2\src\generators.c
....... 15669 2008-06-19 13:13 sts-2.1.2\sts-2.1.2\src\genutils.c
....... 3693 2014-07-08 10:51 sts-2.1.2\sts-2.1.2\src\linearComplexity.c
....... 3770 2009-09-02 20:51 sts-2.1.2\sts-2.1.2\src\longestRunOfOnes.c
............此处省略202个文件信息
相关资源
- UNIX and Linux System Administration Handbook(
- 28x28图片形式mnist训练集
- mnist数据集png图片
- caff-lenet5数据集
- mnist.pkl.gz数据文件
- Tensorflow实现Mnist手写数据集的识别
- MNIST手写数字数据库
- MNIST手写数字数据集
- mnist手写识别资源包。
- mnist数据集177086
- mnist inception score
- opencv3.1用SVM实现MNIST
- fashion-mnist.zip
- Cloudera Administrator Training
- MNIST_data
- 深度学习基础网络模型(mnist手写体识
- MNIST手写字体识别结果模板3万轮训练
- MNIST_data.zip
- MNIST手写字体数据集
- mnist数据集162914
- The Practice of System and Network Administrat
- MNIST手写识别数据集
- mnist图片数据集 png格式
- fashion-mnist数据集
- 解压后的MNIST数据集
- MNIST数据集+mnist_10k_sprite.png
- MNIST数据集CSV格式
- mnist_data_csv.zip
- 手写数字识别MNIST数据集及卷积神经网
- lmdb格式的minist数据集
评论
共有 条评论