Quantum Dice QEaaS API 1.0.5
 
Loading...
Searching...
No Matches
QDRemRand Class Reference

QdremrandPyClient (Quantum Dice Remote Random) is a custom random number generator that extends Python's Random class to provide true randomness from a remote quantum random number generator server. More...

Inheritance diagram for QDRemRand:

Public Member Functions

 __init__ (self, host, port, srvcert, clicert, clikey, verbose=False)
 Initializes the QdremrandPyClient instance and establishes a secure SSL connection to the remote server.
 
 random (self)
 Returns a random float 'x' in the range 0.0 <= X < 1.0.
 
 getrandbits (self, k)
 Returns a random integer with 'k' random bits.
 
 randbytes (self, n)
 Returns n random bytes.
 
 randcertified (self, n)
 Generate n certified random bytes.
 
 seed (self, *args, **kwds)
 Placeholder method for seed.
 
 getstate (self, *args, **kwds)
 Placeholder method for getstate.
 
 randint_64 (self, x=None)
 Generate a 64 bit random integer - used by UserBitGenerator for numpy.
 
 randint_32 (self, x=None)
 Generate a 32 bit random integer - used by UserBitGenerator for numpy.
 

Public Attributes

str bufplain = b''
 Buffer to store received uncertified random bytes.
 
int bufplainpos = 0
 Current position in the uncertified buffer, amount already used in bufplain.
 
int rqplain = 0
 Amount of uncertified random data requested from server but not yet received.
 
int pendplain = 0
 Amount of uncertified random data remaining in the current response.
 
str bufcert = b''
 Buffer to store received certified random bytes ready for use.
 
int bufcertpos = 0
 Current position in the certified buffer, amount already used in bufcert.
 
int rqcert = 0
 Amount of certified random data requested from server but not yet received.
 
int pendcert = 0
 Amount of certified random data remaining in the current response.
 
 ssl_sock = sslctx.wrap_socket(s, server_hostname=host)
 SSL socket for secure communication with the server.
 
str pendplain = b'q'[0]:
 

Static Public Attributes

 setstate = getstate
 Alias for getstate.
 

Detailed Description

QdremrandPyClient (Quantum Dice Remote Random) is a custom random number generator that extends Python's Random class to provide true randomness from a remote quantum random number generator server.

This class establishes a secure SSL connection to a remote server and retrieves quantum-generated random data. It implements various methods for generating random numbers and bytes, ensuring a constant supply of high-quality randomness for cryptographic and scientific applications.

Note
This class is designed to work with a specific quantum random number generator server and requires proper SSL certificates for secure communication.

Constructor & Destructor Documentation

◆ __init__()

__init__ ( self,
host,
port,
srvcert,
clicert,
clikey,
verbose = False )

Initializes the QdremrandPyClient instance and establishes a secure SSL connection to the remote server.

Parameters
host(str): Hostname of the remote random number generator server.
port(int): Port number of the remote server.
srvcert(str): Path to the server's SSL certificate.
clicert(str): Path to the client's SSL certificate.
clikey(str): Path to the client's private key.
verbose(bool, optional): Enable verbose output. Defaults to False.

Member Function Documentation

◆ getrandbits()

getrandbits ( self,
k )

Returns a random integer with 'k' random bits.

◆ getstate()

getstate ( self,
* args,
** kwds )

Placeholder method for getstate.

Not implemented for true random sources.

Raises: NotImplementedError: Always raised as this method is not applicable.

◆ randbytes()

randbytes ( self,
n )

Returns n random bytes.

◆ randcertified()

randcertified ( self,
n )

Generate n certified random bytes.

◆ randint_32()

randint_32 ( self,
x = None )

Generate a 32 bit random integer - used by UserBitGenerator for numpy.

◆ randint_64()

randint_64 ( self,
x = None )

Generate a 64 bit random integer - used by UserBitGenerator for numpy.

◆ random()

random ( self)

Returns a random float 'x' in the range 0.0 <= X < 1.0.

◆ seed()

seed ( self,
* args,
** kwds )

Placeholder method for seed.

This method is not implemented because true randomness sources do not have a seed.

Member Data Documentation

◆ bufcert

str bufcert = b''

Buffer to store received certified random bytes ready for use.

◆ bufcertpos

int bufcertpos = 0

Current position in the certified buffer, amount already used in bufcert.

◆ bufplain

str bufplain = b''

Buffer to store received uncertified random bytes.

◆ bufplainpos

int bufplainpos = 0

Current position in the uncertified buffer, amount already used in bufplain.

◆ pendcert

pendcert = 0

Amount of certified random data remaining in the current response.

◆ pendplain [1/2]

int pendplain = 0

Amount of uncertified random data remaining in the current response.

◆ pendplain [2/2]

str pendplain = b'q'[0]:

◆ rqcert

int rqcert = 0

Amount of certified random data requested from server but not yet received.

◆ rqplain

int rqplain = 0

Amount of uncertified random data requested from server but not yet received.

◆ setstate

setstate = getstate
static

Alias for getstate.

◆ ssl_sock

ssl_sock = sslctx.wrap_socket(s, server_hostname=host)

SSL socket for secure communication with the server.


The documentation for this class was generated from the following file: