
    qh                     P   S r / SQrSSKrSSKrSSKrSSKJrJr  SSKr " S S\	5      r
\
" \R                  5      r\
" \R                  5      rS rS rS	 rS
 rSr SSKJrJr  S rS r\R2                  r\R6                  rS rS rSS jrS rg! \ a    SSKrS rS r N9f = f)a,  Module containing a cryptographic-quality source of randomness and
other cryptographically useful functionality

Python 2.4 needs no external support for this module, nor does Python
2.3 on a system with /dev/urandom.

Other configurations will need a quality source of random bytes and
access to a function that will convert binary strings to long
integers. This module will work with the Python Cryptography Toolkit
(pycrypto) if it is present. pycrypto can be found with a search
engine, but is currently found at:

http://www.amk.ca/python/code/crypto
)
base64ToLongbinaryToLonghmacSha1
hmacSha256longToBase64longToBinaryrandomString	randrangesha1sha256    N)toBase64
fromBase64c                       \ rS rSrS rSrg)HashContainer&   c                 <    Xl         U" 5       R                  U l        g N)newdigest_size)selfhash_constructors     B/var/www/html/env/lib/python3.13/site-packages/openid/cryptutil.py__init__HashContainer.__init__'   s    #+-99    )r   r   N)__name__
__module____qualname____firstlineno__r   __static_attributes__ r   r   r   r   &   s    :r   r   c                     [        U [        5      (       a
  [        U SS9n [        U[        5      (       a
  [        USS9n[        R                  " X[
        5      R                  5       $ Nutf-8)encoding)
isinstancestrbyteshmacr   sha1_moduledigestkeytexts     r   r   r   0   sN    #sC'*$TG,88C{+2244r   c                     [        U [        5      (       a
  [        U SS9n [        R	                  U 5      R                  5       $ r#   )r&   r'   r(   r*   r   r+   ss    r   r
   r
   8   s3    !S!g&??1$$&&r   c                     [        U [        5      (       a
  [        U SS9n [        U[        5      (       a
  [        USS9n[        R                  " X[
        5      R                  5       $ r#   )r&   r'   r(   r)   r   sha256_moduler+   r,   s     r   r   r   >   sN    #sC'*$TG,88C}-4466r   c                     [        U [        5      (       a
  [        U SS9n [        R	                  U 5      R                  5       $ r#   )r&   r'   r(   r3   r   r+   r0   s    r   r   r   F   s5    !S!g&Q&&((r   T)long_to_bytesbytes_to_longc                 Z    U S:  a  [        S5      e[        U 5      nUS   S:  a  SU-   $ U$ )Nr   -This function only supports positive integers       )
ValueErrorr5   )l
bytestrings     r   r   r   f   s<    q5LMM"1%
a=3Z''r   c                 d    U (       d  [        S5      eU S   S:  a  [        S5      e[        U 5      $ )Nz Empty string passed to strToLongr   r9   r8   )r;   r6   )r=   s    r   r   r   p   s4    ?@@a=3LMMZ((r   c                     U S:X  a  g[        [        R                  " U 5      5      nUR                  5         [	        U5      $ )Nr   r:   )	bytearraypickleencode_longreverser(   )r<   bs     r   r   r   V   s3    6f((+,			Qxr   c                     [        U [        5      (       a  U R                  S5      n [        U 5      nUR	                  5         [
        R                  " [        U5      5      $ )Nr$   )r&   r'   encoder@   rC   rA   decode_longr(   )r1   rD   s     r   r   r   ]   sD    a!AaL			!!%(++r   c                 *    [        [        U 5      5      $ r   )r   r   )r<   s    r   r   r      s    LO$$r   c                 *    [        [        U 5      5      $ r   )r   r   r0   s    r   r   r      s    
1&&r   c           	          Uc  [        U 5      $ [        U5      nSR                  [        U 5       Vs/ s H  o1[	        U5         PM     sn5      $ s  snf )z:Produce a string of length random bytes, chosen from chrs. )getByteslenjoinranger	   )lengthchrsn_s       r   r   r      sG    |IwwE&MBMqYq\*MBCCBs   Ac                     [        U 5      [        U5      :w  a  gSn[        [        U 5      5       H  nU=(       a	    X   X   :H  nM     U$ )NFT)rM   rO   )s1s2resultis       r   const_eqrY      sE    
2w#b'F3r7^,RUbe^  Mr   r   ) __doc____all__r)   osrandomopenid.oidutilr   r   hashlibobjectr   r
   r*   r   r3   r   r   SHA256_AVAILABLECrypto.Util.numberr5   r6   r   r   ImportErrorrA   urandomrL   r	   r   r   r   rY   r!   r   r   <module>re      s     	  / :F : GLL)gnn-5'7)  ))?.) :: 	%'DE  , ,,s   B B%$B%