Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/twisted/python/__pycache__/randbytes.cpython-39.pyc
Ðазад
a k�h� � @ s| d Z ddlZddlZddlZeedd�ZejZG dd� de �Z G dd� de �ZG dd � d �Ze� Z e jZe jZ[ g d �ZdS )zQ Cryptographically secure random implementation, with fallback on normal random. � N�getrandbitsc @ s e Zd ZdZdS )�SecureRandomNotAvailablezD Exception raised when no secure random algorithm is found. N��__name__� __module__�__qualname__�__doc__� r r ��/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/twisted/python/randbytes.pyr s r c @ s e Zd ZdZdS )�SourceNotAvailablezQ Internal exception used when a specific random source is not available. Nr r r r r r s r c @ sR e Zd ZdZdZeZdd� Zddd�Zdd � Ze j Zed d �Zdd� Z d d� ZdS )� RandomFactoryz� Factory providing L{secureRandom} and L{insecureRandom} methods. You shouldn't have to instantiate this class, use the module level functions instead: it is an implementation detail and could be removed or changed arbitrarily. r c C sB zt �|�W S ttfy< } zt|��W Y d}~n d}~0 0 dS )zO Wrapper around C{os.urandom} that cleanly manage its absence. N)�os�urandom�AttributeError�NotImplementedErrorr )�self�nbytes�er r r � _osUrandom- s zRandomFactory._osUrandomFc C sJ z| � |�W S ty Y n0 |r>tjdtdd� | �|�S td��dS )ak Return a number of secure random bytes. @param nbytes: number of bytes to generate. @type nbytes: C{int} @param fallback: Whether the function should fallback on non-secure random or not. Default to C{False}. @type fallback: C{bool} @return: a string of random bytes. @rtype: C{str} zPurandom unavailable - proceeding with non-cryptographically secure random source� )�category� stacklevelz!No secure random source availableN)r r �warnings�warn�RuntimeWarning�insecureRandomr )r r �fallbackr r r �secureRandom6 s � zRandomFactory.secureRandomc C s<