[Subversion] / PEAK / src / peak / util / random.py  

Diff of /PEAK/src/peak/util/random.py

Parent Directory | Revision Log

version 444, Thu Jul 4 15:28:35 2002 UTC version 1076, Sat May 3 13:21:20 2003 UTC
Line 1 
Line 1 
 """  """Obtain bytes of random data with varying degrees of quality,
 Obtain bytes of random data with varying degrees of quality, using  using OS facilities for high-quality entropy if available."""
 OS facilities for high-quality entropy if available.  
 """  
   
 __all__ = ['randbytes', 'rand16']  __all__ = ['randbytes', 'rand16']
   
Line 22 
Line 20 
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
 lasthash = seedhash = ''  lasthash = seedhash = ''
   
 def prng_some():  def prng_some():
Line 56 
Line 73 
 prng_some()  prng_some()
   
   
   
   
   
   
   
   
   
 def prng(nbytes):  def prng(nbytes):
     """      """
     A PRNG that hopefully is better than just using whrandom.      A PRNG that hopefully is better than just using whrandom.
Line 93 
Line 117 
         return None          return None
   
   
   
   
   
   
 funcs = {  funcs = {
     #(prng, wait) : function      #(prng, wait) : function
   
Line 120 
Line 148 
 # through python, it should be added here. XXX  # through python, it should be added here. XXX
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
 def randbytes(nbytes, prng=1, wait=0):  def randbytes(nbytes, prng=1, wait=0):
     """      """
     Get nbytes number of bytes of randomness if possible.      Get nbytes number of bytes of randomness if possible.
Line 143 
Line 185 
   
     s = randbytes(2, prng, wait)      s = randbytes(2, prng, wait)
     return (ord(s[0]) << 8) | ord(s[1])      return (ord(s[0]) << 8) | ord(s[1])
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   


Generate output suitable for use with a patch program
Legend:
Removed from v.444  
changed lines
  Added in v.1076

cvs-admin@eby-sarna.com

Powered by ViewCVS 1.0-dev

ViewCVS and CVS Help