Table of Contents

Module: entropy src/entropy.py

Thread Scheduling Entropy Pseudo Random Number Generator and Random Pool CSPRNGs

Imported modules   
from aes import *
from cPickle import *
from sha256 import *
import sys
from threading import Thread, Event, Lock
import time
from whrandom import whrandom
Functions   
CreateBuffers
CreateList
ShuffleBuffers
ShuffleMix
Taint
TaintBuffers
TaintList
rAppend
trandom
  CreateBuffers 
CreateBuffers (
        bufferamount,
        buffersize,
        random,
        )

Internal use only. Don't call this.

  CreateList 
CreateList (
        emptylist,
        listsize,
        racecontrol,
        random,
        )

Internal use only. Don't call this.

  ShuffleBuffers 
ShuffleBuffers ( lists,  random )

Internal use only. Don't call this.

  ShuffleMix 
ShuffleMix (
        list1,
        list2,
        racecontrol,
        random,
        )

Internal use only. Don't call this.

  Taint 
Taint (
        list,
        index,
        racecontrol,
        random,
        )

The race condition is the call to the shared random number generator.

Very processor intensive. Very entropic.

Internal use only. Don't call this.

  TaintBuffers 
TaintBuffers ( lists,  random )

Internal use only. Don't call this.

  TaintList 
TaintList (
        list,
        racecontrol,
        random,
        )

Internal use only. Don't call this.

  rAppend 
rAppend (
        list,
        char,
        racecontrol,
        )

Appends the thread's identity (the character assigned to it) into a shared list

  trandom 
trandom (
        bufferAmount=4,
        bufferSize=8,
        rounds=3,
        x=0,
        y=0,
        z=0,
        )

The only external interface to the TSEPRNG. Call this function to get random data.

Keep in mind that this is resource intensive random number generation. You should only be calling this function for cryptographically secure entropy. It is highly customizable.

bufferAmount sets the number of buffers to be raced over. The more, the merrier. Just watch the resources. This value should be proportional to your paranoia.

bufferSize is the size in bytes of the buffer to randomize. Make sure the buffer size is a multiple of 2.

rounds specify how many iterations of the algorithm to conduct. This value should be proportional to your paranoia. Cranking this will greatly increase both the time required to generate a number and the overall unpredictability of the result.

x, y, z are seed initializers to whrandom. Although the TSEPRNG will produce numbers that are intractable to the seed used, you can set these by hand it you wish. The default (0,0,0) will result in a time-based seed.

The total number of threads that participate in the race is equal to bufferAmount bufferSize*.

The function will return a string of length bufferAmount bufferSize*.

This function defaults to 4 buffers of 8 bytes over 3 rounds with seeds of 0,0,0.

Exceptions   
ValueError( "If the Buffer amount is a multiple of two (2), more entropy results." )
Classes   
CSPRNG

Cryptographically Secure Pseudo Random Number Generation.

EntropyPool

Cryptographically strong random number generation.

threadgate

The thread gatekeeper.


Table of Contents

This document was automatically generated on Thu Nov 29 11:49:10 2001 by HappyDoc version r1_6_1