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...
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. | |
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.
| __init__ | ( | self, | |
| host, | |||
| port, | |||
| srvcert, | |||
| clicert, | |||
| clikey, | |||
| verbose = False ) |
Initializes the QdremrandPyClient instance and establishes a secure SSL connection to the remote server.
| 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. |
| getrandbits | ( | self, | |
| k ) |
Returns a random integer with 'k' random bits.
| 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 | ( | self, | |
| n ) |
Returns n random bytes.
| randcertified | ( | self, | |
| n ) |
Generate n certified random bytes.
| randint_32 | ( | self, | |
| x = None ) |
Generate a 32 bit random integer - used by UserBitGenerator for numpy.
| randint_64 | ( | self, | |
| x = None ) |
Generate a 64 bit random integer - used by UserBitGenerator for numpy.
| random | ( | self | ) |
Returns a random float 'x' in the range 0.0 <= X < 1.0.
| seed | ( | self, | |
| * | args, | ||
| ** | kwds ) |
Placeholder method for seed.
This method is not implemented because true randomness sources do not have a seed.
| 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.
| str bufplain = b'' |
Buffer to store received uncertified random bytes.
| int bufplainpos = 0 |
Current position in the uncertified buffer, amount already used in bufplain.
| pendcert = 0 |
Amount of certified random data remaining in the current response.
| int pendplain = 0 |
Amount of uncertified random data remaining in the current response.
| str pendplain = b'q'[0]: |
| int rqcert = 0 |
Amount of certified random data requested from server but not yet received.
| int rqplain = 0 |
Amount of uncertified random data requested from server but not yet received.
|
static |
Alias for getstate.
| ssl_sock = sslctx.wrap_socket(s, server_hostname=host) |
SSL socket for secure communication with the server.