added inline docu
This commit is contained in:
parent
f846c0e8ae
commit
71bc93b7b7
3 changed files with 20 additions and 3 deletions
|
|
@ -2,6 +2,10 @@ import os
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
def install():
|
def install():
|
||||||
|
"""
|
||||||
|
Tries to fetch TemporalLib from GitHub and build it
|
||||||
|
|
||||||
|
"""
|
||||||
print("TemporalLib not found. Attempting to install it...")
|
print("TemporalLib not found. Attempting to install it...")
|
||||||
print("==================================================")
|
print("==================================================")
|
||||||
module_path = os.path.abspath(os.path.dirname(__file__))
|
module_path = os.path.abspath(os.path.dirname(__file__))
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@ import json
|
||||||
from urllib3.exceptions import InsecureRequestWarning
|
from urllib3.exceptions import InsecureRequestWarning
|
||||||
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
|
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
|
||||||
|
|
||||||
VERSION = '1.0.0'
|
|
||||||
URL = 'https://qrng.randonautica.com/api/json/'
|
URL = 'https://qrng.randonautica.com/api/json/'
|
||||||
typeS = {
|
typeS = {
|
||||||
'int32' : 'randint32',
|
'int32' : 'randint32',
|
||||||
|
|
@ -22,7 +21,14 @@ typeS = {
|
||||||
DEVICE_ID = 'QWR70154'
|
DEVICE_ID = 'QWR70154'
|
||||||
|
|
||||||
def get(length=10, type='hex16'):
|
def get(length=10, type='hex16'):
|
||||||
"""Fetch data from the Randonautica Quantum Random Numbers JSON API"""
|
"""
|
||||||
|
Fetch data from the Randonautica Quantum Random Numbers JSON API
|
||||||
|
|
||||||
|
length (int): length of bytes to get from the QRNG when `type=hex16`
|
||||||
|
type (string): type of random number data to fetch.
|
||||||
|
Valid choices are `hex16`, `int32`, `uniform`, `normal`, `base64`
|
||||||
|
|
||||||
|
"""
|
||||||
if type not in typeS.keys():
|
if type not in typeS.keys():
|
||||||
raise Exception("type must be one of %s" % typeS.keys())
|
raise Exception("type must be one of %s" % typeS.keys())
|
||||||
url = URL + typeS[type] + '?' + urlencode({
|
url = URL + typeS[type] + '?' + urlencode({
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,14 @@ from subprocess import check_output as exec
|
||||||
from .install import install
|
from .install import install
|
||||||
|
|
||||||
def get(length=10, channel=0):
|
def get(length=10, channel=0):
|
||||||
length *= 2
|
"""
|
||||||
|
Fetch data from the local TemporalLib RNG and returns a string of hex16
|
||||||
|
|
||||||
|
length (int): length of bytes to get from the RNG
|
||||||
|
channel (int): 0 for slower but higher quality entropy, 1 for faster but lower quality entropy
|
||||||
|
|
||||||
|
"""
|
||||||
|
length *= 2 # returns nibbles by default, so let's make that bytes
|
||||||
module_path = os.path.abspath(os.path.dirname(__file__))
|
module_path = os.path.abspath(os.path.dirname(__file__))
|
||||||
temporal_path = os.path.abspath(f"{module_path}/temporal")
|
temporal_path = os.path.abspath(f"{module_path}/temporal")
|
||||||
exe_path = f'{temporal_path}/result/{os.uname().sysname}/temporal'
|
exe_path = f'{temporal_path}/result/{os.uname().sysname}/temporal'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue