Please, for the love of all that is good in this world, do not use this for cryptography. Except the cryptography class. Let's all use this for the cryptography class.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
885 B

import time, os, struct
import fasteners
import threading
ENTROPY_FILE = "ted.pkk"
class EntropyPipe(object):
def __init__(self):
self._lock = threading.Lock()
def add_entropy(self,bits):
with open(ENTROPY_FILE,'ab') as f:
b = bytearray(bits)
def invoke_entropy(self,num_bits):
if num_bits == 0:
return None
with open(ENTROPY_FILE,'rb') as f:
bits =
newdata =
with open(ENTROPY_FILE, 'wb') as out_file:
bits_int = []
for b in bits:
#bits_int = [1 if b == b'\x01' else 0 for b in bits]
return bits_int