https://github.com/urda/nistbeacon
Python 3 Library to access the NIST Randomness Beacon
https://github.com/urda/nistbeacon
nist nist-randomness-beacon python
Last synced: about 1 year ago
JSON representation
Python 3 Library to access the NIST Randomness Beacon
- Host: GitHub
- URL: https://github.com/urda/nistbeacon
- Owner: urda
- License: apache-2.0
- Created: 2015-11-17T23:53:32.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2020-11-08T07:16:33.000Z (over 5 years ago)
- Last Synced: 2025-03-25T12:51:16.938Z (about 1 year ago)
- Topics: nist, nist-randomness-beacon, python
- Language: Python
- Homepage: https://urda.github.io/nistbeacon/
- Size: 1.73 MB
- Stars: 9
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGELOG.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
Python NIST Randomness Beacon
=============================
**WARNING: DO NOT USE BEACON GENERATED VALUES AS SECRET CRYPTOGRAPHIC
KEYS.**
Installation
============
Prerequisites
-------------
A required library :code:`pycryptodome` is used with :code:`nistbeacon`.
Ubuntu, and other Linux-based users should have :code:`python3-dev` installed.
.. code:: bash
apt-get install python3-dev
Installing :code:`nistbeacon`
-----------------------------
To install the beacon library, simply use :code:`pip`:
.. code:: bash
pip install nistbeacon
Beacon Usage
============
It is easy to use the beacon. Most queries are performed through
:code:`NistBeacon` which produces :code:`NistBeaconValue` objects.
Beacon Sample Code
------------------
.. code:: python
from nistbeacon import NistBeacon
# In the examples below I will be using 1447873020
# as my when required
# Current Record (or next closest)
# https://beacon.nist.gov/rest/record/
record = NistBeacon.get_record(1447873020)
# Previous Record
# https://beacon.nist.gov/rest/record/previous/
prev_record = NistBeacon.get_previous(1447873020)
# Next Record
# https://beacon.nist.gov/rest/record/next/
next_record = NistBeacon.get_next(1447873020)
# First Record
# https://beacon.nist.gov/rest/record/1378395540
first_record = NistBeacon.get_first_record(download=True)
# Last Record
# https://beacon.nist.gov/rest/record/last
last_record = NistBeacon.get_last_record()
# Verify the record and the record chain
record_chain_result = NistBeacon.chain_check(1447873020)
Further Documentation
=====================
Please refer to the
`official documentation `_
to dive deeper into :code:`NistBeacon` and :code:`NistBeaconValue` objects.
Contributing
============
Please refer to the
`CONTRIBUTING `_
document on GitHub
Project Health
==============
+---------+-----------------+--------------------+----------------------+
| Branch | Linting Checks | Testing Status | Code Coverage Status |
+=========+=================+====================+======================+
| Master | |MasterLint| | |MasterTesting| | |MasterCoverage| |
+---------+-----------------+--------------------+----------------------+
References
==========
- `NIST Randomness Beacon Homepage `_
- `NIST Beacon REST API `_
.. |MasterCoverage| image:: https://codecov.io/gh/urda/nistbeacon/branch/master/graph/badge.svg?branch=master
.. |MasterLint| image:: https://github.com/urda/nistbeacon/workflows/Linting%20Checks/badge.svg?branch=master
.. |MasterTesting| image:: https://github.com/urda/nistbeacon/workflows/Comprehensive%20Testing/badge.svg?branch=master