ó
    Ö›‘h´  ã                   óÔ   • S r SSKrSSKrSSKr\" \SS5      r\R                  r " S S\	5      r
 " S S\	5      r " S S	5      r\" 5       r\R                  r\R                  rC/ S
Qrg)zQ
Cryptographically secure random implementation, with fallback on normal random.
é    NÚgetrandbitsc                   ó   • \ rS rSrSrSrg)ÚSecureRandomNotAvailableé   z<
Exception raised when no secure random algorithm is found.
© N©Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú__static_attributes__r   ó    Ú\C:\Users\psant\Downloads\Noiseback\school\venv\Lib\site-packages\twisted/python/randbytes.pyr   r      ó   † ôr   r   c                   ó   • \ rS rSrSrSrg)ÚSourceNotAvailableé   zI
Internal exception used when a specific random source is not available.
r   Nr   r   r   r   r   r      r   r   r   c                   ó¬   • \ rS rSrSrSr\rS\S\4S jr	SS\S\
S\4S jjrS\S\4S	 jr\R                  r\" S
S
5      rS\S\4S jrS\S\4S jrSrg)ÚRandomFactoryé   zå
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                 óv   •  [         R                  " U5      $ ! [        [        4 a  n[	        U5      eSnAff = f)z?
Wrapper around C{os.urandom} that cleanly manage its absence.
N)ÚosÚurandomÚAttributeErrorÚNotImplementedErrorr   )Úselfr   Úes      r   Ú
_osUrandomÚRandomFactory._osUrandom-   s7   € ð	(Ü—:’:˜fÓ%Ð%øÜÔ 3Ð4ó 	(Ü$ QÓ'Ð'ûð	(ús   ‚ ˜8¨3³8Úfallbackc                 óÀ   •  U R                  U5      $ ! [         a     Of = fU(       a+  [        R                  " S[        SS9  U R                  U5      $ [        S5      e)a#  
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)r!   r   ÚwarningsÚwarnÚRuntimeWarningÚinsecureRandomr   )r   r   r#   s      r   ÚsecureRandomÚRandomFactory.secureRandom6   sd   € ð	Ø—?‘? 6Ó*Ð*øÜ!ó 	Ùð	úö Ü�MŠMðMä'Øò	ð ×&Ñ& vÓ.Ð.ä*Ð+NÓOÐOó   ‚ “
 Ÿ c                 ó†   • U R                   b*  U R                  US-  5      nSUS-  -  U-  n[        U5      $ [        S5      e)z#
Wrapper around C{os.getrandbits}.
é   z%%0%dxr%   z#random.getrandbits is not available)r   Ú_fromhexr   )r   r   ÚnÚhexBytess       r   Ú	_randBitsÚRandomFactory._randBitsS   sN   € ð ×ÑÑ'Ø× Ñ  ¨!¡Ó,ˆAØ  F¨Q¡JÑ/°1Ñ4ˆHÜ˜HÓ%Ð%Ü Ð!FÓGÐGr   r   c           
      ó²   • SR                  [        U5       Vs/ s H-  n[        [        R                  " U R
                  5      /5      PM/     sn5      $ s  snf )z&
Wrapper around the C{random} module.
r   )ÚjoinÚrangeÚbytesÚrandomÚchoiceÚ_BYTES)r   r   Úis      r   Ú_randModuleÚRandomFactory._randModule`   s>   € ð �x‰xÄeÈFÄmÓTÂmÀœ¤§¢¨d¯k©kÓ :Ð;Ö<ÁmÑTÓUÐUùÒTs   ™4Ac                 óh   •  U R                  U5      $ ! [         a     Of = fU R                  U5      $ )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}
)r4   r   r>   )r   r   s     r   r+   ÚRandomFactory.insecureRandomf   s9   € ð	Ø—>‘> &Ó)Ð)øÜ!ó 	Ùð	úà×Ñ Ó'Ð'r.   N)F)r	   r
   r   r   r   ÚrandomSourcesr   Úintr9   r!   Úboolr,   r4   Ú	maketransÚ
_maketransr<   r>   r+   r   r   r   r   r   r      sš   † ñð €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   r   r:   r(   Úgetattrr   r9   Úfromhexr1   ÚRuntimeErrorr   r   r   Úfactoryr,   r+   Ú__all__r   r   r   Ú<module>rL      s{   ðñ
ó
 
Û Û á�f˜m¨TÓ2€à�=‰=€ô˜|ô ô˜ô ÷U(ñ U(ñp ‹/€à×#Ñ#€à×'Ñ'€àò I�r   