Table of Contents

Module: random ./src/peak/util/random.py

Obtain bytes of random data with varying degrees of quality, using OS facilities for high-quality entropy if available.

Imported modules   
import os
import sys
import time
Functions   
devrandom
devurandom
fail
prng
prng_some
rand16
randbytes
  devrandom 
devrandom ( nbytes )

  devurandom 
devurandom ( nbytes )

  fail 
fail ( nbytes )

  prng 
prng ( nbytes )

A PRNG that hopefully is better than just using random. Don't trust this for crypto, though!

  prng_some 
prng_some ()

  rand16 
rand16 ( prng=1,  wait=0 )

  1. bit unsigned random number

  randbytes 
randbytes (
        nbytes,
        prng=1,
        wait=0,
        )

Get nbytes number of bytes of randomness if possible.

If prng is true, pseudo-randomly generated data of unknown quality is OK. If false, only crypto-quality entropy is acceptable.

If wait is true, caller is willing to wait an unspecified period of time in exchange for better quality randomness. If false, return the best randomness presently available.

If the constraints cannot be met, return None.


Table of Contents

This document was automatically generated on Mon Nov 11 01:11:04 2024 by HappyDoc version 2.1