相关文章推荐
爱吹牛的人字拖  ·  python request ...·  2 年前    · 
跑龙套的弓箭  ·  mysql - GROUP_CONCAT ...·  2 年前    · 
销魂的海豚  ·  LinQ to SQL 使用 Any() ...·  2 年前    · 

特别说明:本文写于 2018 年 5 月,当时 David Johnston 发布的 sp800_22_tests 工具还不能在 Python 3 环境下运行,在 2018 年 6 月,David Johnston 在 GitHub 上发布了新的程序,新版程序能够在 Python 3 环境下直接运行了。

要在一台安装了 64 位 CentOS 6.9 的计算机上运行随机性检测工具 sp800_22_tests,操作系统自带的 Python 版本是 2.6.6,sp800_22_tests 在 Python 2.7 下可以正常运行,在 Python 2.6 下运行会出错。对于这台计算机,实际情况不允许修改默认的 Python 设置。经过一番尝试后终于能成功运行测试工具了,把过程记录如下:
1)安装 Python 2.7;
下载 Python2.7.15,网址是:https://www.python.org/ftp/python/2.7.15/Python-2.7.15.tgz 。这里创建了一个目录 /myfiles/python27,解压缩 tgz 文件以后,使用以下命令安装到该目录下:
./configure --prefix=/myfiles/python27
make
make install
2)安装与 sp800_22_tests 相关的 Python 包 argparse 和 NumPy;
执行以下命令:
/myfiles/python27/bin/pip install argparse
/myfiles/python27/bin/pip install setuptools    (安装NumPy时需要用到 setuptools)
/myfiles/python27/bin/pip install numpy
3) 运行随机性测试工具。
到 sp800_22_tests 的 py 类型文件所在目录下,执行命令:
/myfiles/python27/bin/python sp800_22_tests.py 二进制随机数文件名
例如:
/myfiles/python27/bin/python sp800_22_tests.py data.sha1
执行结果如下图:


这里用到的 data.sha1 文件是从 NIST 提供的一个随机性检测工具文件中提取出来的,这个工具文件的下载网址是:https://csrc.nist.gov/CSRC/media/Projects/Random-Bit-Generation/documents/sts-2_1_2.zip

github _actions_toolkit Dart编码的第三方工具包。 它受到官方Javascript 启发,并包含类似的命令。 查看,以获取Dart GitHub 操作的完整示例。 日志命令可在log下 使用 。 有四个级别: error warning debug 具有info级别的日志不会特别强调, stdout直接传输到stdout 。 仅当在存储库中创建了值为true的机密ACTIONS_STEP_DEBUG时,才会显示具有debug级别的日志(请参见“ ”)。 import 'package: github _actions_toolkit/ github _actions_toolkit.dart' as gaction; main () async { const logger = gaction.log; logger 在windows环境下,需要安装软件Cygwin Cygwin官网下载地址:http://www.cygwin.com/ 安装 使用 该软件参考:http://www.programarts.com/cfree_ch/doc/help/UsingCF/CompilerSupport/Cygwin/Cygwin1.htm 1 安装之后,打开Cygwin输入命令进入sts-2.1.2目录 2 将待 测试 的序列 文件 (比如a.txt)移到该目录下, NIST 标准要求文数据长度至少1 000 000位(1M),如果少于该长 NIST 发布过一个编号为 SP 800- 22 rev1a、名为 《A Statistical Test Suite for the Validation of Random Number Generators and Pseudo Random Number Generators for Cryptographic Application》的文档,在其中 介绍 了 15 种检测 随机性 ... 结帐代码: git checkout https:// github .com/mazipan/explore- github .git 安装依赖项: npm install或yarn install 在本地npm run dev : npm run dev 如果您想贡献,请前往。 在内部,您将找到有关开放问题,编码标准和开发说明的说明。 直接支持, This paper discusses some aspects of selecting and testing random and pseudorandom number generators. The outputs of such generators may be used in many cryptographic applications, such as the generation of key material. Generators suitable for use in cryptographic applications may need to meet stronger requirements than for other applications. In particular, their outputs must be unpredictable in the absence of knowledge of the inputs. Some criteria for characterizing and selecting appropriate generators are discussed in this document. The subject of statistical testing and its relation to cryptanalysis is also discussed, and some recommended statistical tests are provided. These tests may be useful as a first step in determining whether or not a generator is suitable for a particular cryptographic application. However, no set of statistical tests can absolutely certify a generator as appropriate for usage in a particular application, i.e., statistical testing cannot serve as a substitute for cryptanalysis. The design and cryptanalysis of generators is outside the scope of this paper. Key words: random number generator, hypothesis test, P-value     David Johnston 在 GitHub 上发布了一个名为 sp800 _ 22 _ tests 的工具,网址是:https:// github .com/dj-on- github / sp800 _ 22 _ tests ,它是一个用 Python 语言写的程序集,能够根据 NIST SP 800- 22 文档的要求,检测随机数集合的 随机性 ,包括以下 15 种 测试 种类:    monobit_test   ... 我国随机检测规范GM/T 0005-2012《 随机性 检测规范》,现已经升级为国家标准GB/T 32915-2016 信息安全技术 二元序列 随机性 检测方法。 NIST 随机性 检测文档 NIST SP800 - 22 r1a,A Statistical Test Suite for Random and Pseudorandom Number Generators for Cryptographic Applications。 1 检测项对比 NIST 和国密 随机性 检测项目的对比如下: NIST . NIST 测试 套件是由15个 测试 组成的统计软件包,这些是为了 测试 随机(任意长度)由基于硬件或软件的密码随机或伪随机数生成器产生的二进制序列。 测试 关注于各种不同类型的已存在的非随机序列。有些 测试 可以分成各种子 测试 。 15个 测试 主要是(属于密码算法安全 测试 方法): 频率(单比特) 测试 块内频数 测试 (Frequency Test within a Block) 动向(Run) 测试 最大游程检测... NIST 在其官网地址 https://csrc. nist .gov/Projects/Random-Bit-Generation/Documentation-and-Software 上发布了 NIST SP 800- 22 Revision 1a 文档和配套的 测试 软件包。 NIST SP 800- 22 Revision 1a 文档的全名是《A Statistical Test Suite f... SP800 是美国 NIST (National Institute of Standards and Technology)发布的一系列关于信息安全的指南(SP是Special Publications的缩写)。文档很多,也很细,值得大家学习。        在 NIST 的标准系列 文件 中,虽然 NIST SP并不作为正式法定标准,但在实际工作中,已