%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/twisted/python/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/twisted/python/__pycache__/randbytes.cpython-312.pyc

�

Ϫ�f�
����dZddlZddlZddlZeedd�ZejZGd�de	�Z
Gd�de	�ZGd�d	�Ze�Z
e
jZe
jZ[
gd
�Zy)zQ
Cryptographically secure random implementation, with fallback on normal random.
�N�getrandbitsc��eZdZdZy)�SecureRandomNotAvailablezD
    Exception raised when no secure random algorithm is found.
    N��__name__�
__module__�__qualname__�__doc__���:/usr/lib/python3/dist-packages/twisted/python/randbytes.pyrr���rrc��eZdZdZy)�SourceNotAvailablezQ
    Internal exception used when a specific random source is not available.
    Nrrrr
rrrrrc��eZdZdZdZeZdedefd�Zd
dede	defd�Z
dedefd�ZejZ
e
d	d	�Zdedefd
�Zdedefd�Zy)�
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�nbytes�returnc�r�	tj|�S#ttf$r}t	|��d}~wwxYw)zO
        Wrapper around C{os.urandom} that cleanly manage its absence.
        N)�os�urandom�AttributeError�NotImplementedErrorr)�selfr�es   r
�
_osUrandomzRandomFactory._osUrandom-s7��	(��:�:�f�%�%��� 3�4�	(�$�Q�'�'��	(�s��6�1�6�fallbackc��	|j|�S#t$rYnwxYw|r-tjdtd��|j|�St
d��)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 available)rr�warnings�warn�RuntimeWarning�insecureRandomr)rrrs   r
�secureRandomzRandomFactory.secureRandom6sd��	��?�?�6�*�*��!�	��	����M�M�M�'��	
��&�&�v�.�.�*�+N�O�O���	�c��|j�*|j|dz�}d|dzz|z}t|�Std��)z3
        Wrapper around C{os.getrandbits}.
        �z%%0%dxrz#random.getrandbits is not available)r�_fromhexr)rr�n�hexBytess    r
�	_randBitszRandomFactory._randBitsSsN�����'�� � ��!��,�A� �F�Q�J�/�1�4�H��H�%�%� �!F�G�Grrc
��djt|�D�cgc]+}ttj|j
�g���-c}�Scc}w)z6
        Wrapper around the C{random} module.
        r)�join�range�bytes�random�choice�_BYTES)rr�is   r
�_randModulezRandomFactory._randModule`s:���x�x�e�F�m�T����
�
�d�k�k� :�;�<�T�U�U��Ts�0Ac�f�	|j|�S#t$rYnwxYw|j|�S)z�
        Return a number of non secure random bytes.

        @param nbytes: number of bytes to generate.
        @type nbytes: C{int}

        @return: a string of random bytes.
        @rtype: C{str}
        )r-rr6)rrs  r
r%zRandomFactory.insecureRandomfs9��	��>�>�&�)�)��!�	��	������'�'r'N)F)rrr	r
�
randomSourcesr�intr1r�boolr&r-�	maketrans�
_maketransr4r6r%rrr
rrs�����M��K�(��(��(�P�3�P�$�P�5�P�:H��H��H����J�
��S�
!�F�V�#�V�%�V�(�S�(�U�(rr)r&r%r)r
rr2r"�getattrrr1�fromhexr*�RuntimeErrorrrr�factoryr&r%�__all__rrr
�<module>rBs{��
�

�
���f�m�T�2���=�=���|�����U(�U(�p�/���#�#���'�'���I�r

Zerion Mini Shell 1.0