访问NIST随机信标的Python3库
nistbeacon的Python项目详细描述
python nist随机信标
警告:不要将信标生成的值用作机密加密 按键。
安装
先决条件
所需的库pycryptodome
与nistbeacon
一起使用。
ubuntu和其他基于linux的用户应该安装python3-dev
。
apt-get install python3-dev
安装nistbeacon
要安装信标库,只需使用pip
:
pip install nistbeacon
信标用法
使用信标很容易。大多数查询都是通过
NistBeacon
它生成NistBeaconValue
对象。
信标样本代码
fromnistbeaconimportNistBeacon# In the examples below I will be using 1447873020# as my <timestamp> when required# Current Record (or next closest)# https://beacon.nist.gov/rest/record/<timestamp>record=NistBeacon.get_record(1447873020)# Previous Record# https://beacon.nist.gov/rest/record/previous/<timestamp>prev_record=NistBeacon.get_previous(1447873020)# Next Record# https://beacon.nist.gov/rest/record/next/<timestamp>next_record=NistBeacon.get_next(1447873020)# First Record# https://beacon.nist.gov/rest/record/1378395540first_record=NistBeacon.get_first_record(download=True)# Last Record# https://beacon.nist.gov/rest/record/lastlast_record=NistBeacon.get_last_record()# Verify the record and the record chainrecord_chain_result=NistBeacon.chain_check(1447873020)
其他文档
请参考
official documentation
深入研究NistBeacon
和NistBeaconValue
对象。
贡献
请参考 CONTRIBUTING github上的文档