
     hMO                     l   d Z ddlZddlZ ej                  e      ZddlmZ ddlm	Z	 ddl
mZmZ ddlmZ ddlmZmZmZ ddlmZ dd	lmZ g d
Z G d de      Z e       Z e       Zej<                  Z e di ddddddddddddddddddddddddd dd!dd"d#d$d#d%d#d&d#d'd#d(d#d)d#d*d#d+d#d,dd-d.d/dd0d1d2d1d3d1d4d1d5d1d6d1d7d8d9d8d:d8d;d<d=d<d>d8d?d8d@d8dAd8dBd8dCd8dDd8dEd8dFd8dGd8dHd8dIddJddKddLddMddNddOddPdQdRdQdSdTdUdTdVddWdXdYdXdZdd[dd\dd]d^d_d`dadbdcd<dddedfdgdhdidjdkdldkdmdndod`dpd`Z! ejD                  dq      Z# e$g dr      Z%ds Z&dt Z'ddvZ(efdwZ)ddxZ*ddyZ+ddzZ,dd{Z-d|Z.d}Z/d~Z0e.dufdZ1ed        Z2d Z3y)z6passlib.registry - registry for password hash handlers    N)warn)exc)ExpectedTypeErrorPasslibWarning)PasswordHash)is_crypt_handler	has_cryptunix_crypt_schemes)unicode_or_str)memoize_single_value)register_crypt_handler_pathregister_crypt_handlerget_crypt_handlerlist_crypt_handlersc                   0    e Zd ZdZdZ dZd Zd Zd Zd Zy)_PasslibRegistryProxyzproxy module passlib.hash

    this module is in fact an object which lazy-loads
    the requested password hash algorithm from wherever it has been stored.
    it acts as a thin wrapper around :func:`passlib.registry.get_crypt_handler`.
    zpasslib.hashNc                 |    |j                  d      rt        d|      t        |d       }|r|S t        d|      )N_zmissing attribute: zunknown password hash: )
startswithAttributeErrorr   )selfattrhandlers      R/var/www/html/Resume-Scraper/venv/lib/python3.12/site-packages/passlib/registry.py__getattr__z!_PasslibRegistryProxy.__getattr__(   s>    ??3 D!BCC#D$/N !FGG    c                 p    |j                  d      rt        j                  | ||       y t        ||       y )Nr   _attr)r   object__setattr__r   )r   r   values      r   r!   z!_PasslibRegistryProxy.__setattr__1   s.    ??3 tT51 #55r   c                      y)Nz<proxy module 'passlib.hash'> )r   s    r   __repr__z_PasslibRegistryProxy.__repr__;   s    .r   c                     t        t        | j                              }|j                  | j                         |j                  t
               t        |      S N)setdir	__class__update__dict__
_locationssorted)r   attrss     r   __dir__z_PasslibRegistryProxy.__dir__>   s=     C'(T]]#Z e}r   )	__name__
__module____qualname____doc____package__r   r!   r%   r0   r$   r   r   r   r      s(     HKH6/r   r   apr_md5_cryptzpasslib.handlers.md5_cryptargon2zpasslib.handlers.argon2atlassian_pbkdf2_sha1zpasslib.handlers.pbkdf2bcryptzpasslib.handlers.bcryptbcrypt_sha256bigcryptzpasslib.handlers.des_crypt
bsd_nthashzpasslib.handlers.windows
bsdi_crypt	cisco_pixzpasslib.handlers.cisco	cisco_asacisco_type7cta_pbkdf2_sha1crypt16	des_cryptdjango_argon2zpasslib.handlers.djangodjango_bcryptdjango_bcrypt_sha256django_pbkdf2_sha256django_pbkdf2_sha1django_salted_sha1django_salted_md5django_des_cryptdjango_disableddlitz_pbkdf2_sha1fshpzpasslib.handlers.fshpgrub_pbkdf2_sha512hex_md4zpasslib.handlers.digestshex_md5hex_sha1
hex_sha256
hex_sha512htdigestldap_plaintextzpasslib.handlers.ldap_digestsldap_md5	ldap_sha1ldap_hex_md5zpasslib.handlers.roundupldap_hex_sha1ldap_salted_md5ldap_salted_sha1ldap_salted_sha256ldap_salted_sha512ldap_des_cryptldap_bsdi_cryptldap_md5_cryptldap_bcryptldap_sha1_cryptldap_sha256_cryptldap_sha512_cryptldap_pbkdf2_sha1ldap_pbkdf2_sha256ldap_pbkdf2_sha512lmhash	md5_cryptmsdccmsdcc2	mssql2000zpasslib.handlers.mssql	mssql2005mysql323zpasslib.handlers.mysqlmysql41nthashoracle10zpasslib.handlers.oracleoracle11pbkdf2_sha1pbkdf2_sha256pbkdf2_sha512phpasszpasslib.handlers.phpass	plaintextzpasslib.handlers.miscpostgres_md5zpasslib.handlers.postgresroundup_plaintextscramzpasslib.handlers.scramscryptzpasslib.handlers.scrypt
sha1_cryptzpasslib.handlers.sha1_cryptsha256_cryptzpasslib.handlers.sha2_cryptsha512_cryptsun_md5_cryptzpasslib.handlers.sun_md5_cryptunix_disabledunix_fallbackz^[a-z][a-z0-9_]+[a-z0-9]$)onloadpolicycontextalldefaultnoneautoc                     | st        d|       | j                         | k7  rt        d|       t        j                  |       st        d|       d| v rt        d|       | t        v rt        d|       y)zhelper to validate handler name

    :raises ValueError:
        * if empty name
        * if name not lower case
        * if name contains double underscores
        * if name is reserved (e.g. ``context``, ``all``).
    zhandler name cannot be empty: zname must be lower-case: z^invalid name (must be 3+ characters,  begin with a-z, and contain only underscore, a-z, 0-9): __z)name may not contain double-underscores: zthat name is not allowed: T)
ValueErrorlower_name_rematch_forbidden_names)names    r   _validate_handler_namer      s     tEFFzz|t$@AA>>$'+. / 	/ t|! " 	"4ABBr   c                 6   t        |        |j                  d      rt        d      d|v rN|j                  d      dkD  rt        d      |j	                  d|j                  d            dkD  rt        d      |t        | <   t        j                  d| |       y	)
av  register location to lazy-load handler when requested.

    custom hashes may be registered via :func:`register_crypt_handler`,
    or they may be registered by this function,
    which will delay actually importing and loading the handler
    until a call to :func:`get_crypt_handler` is made for the specified name.

    :arg name: name of handler
    :arg path: module import path

    the specified module path should contain a password hash handler
    called :samp:`{name}`, or the path may contain a colon,
    specifying the module and module attribute to use.
    for example, the following would cause ``get_handler("myhash")`` to look
    for a class named ``myhash`` within the ``myapp.helpers`` module::

        >>> from passlib.registry import registry_crypt_handler_path
        >>> registry_crypt_handler_path("myhash", "myapp.helpers")

    ...while this form would cause ``get_handler("myhash")`` to look
    for a class name ``MyHash`` within the ``myapp.helpers`` module::

        >>> from passlib.registry import registry_crypt_handler_path
        >>> registry_crypt_handler_path("myhash", "myapp.helpers:MyHash")
    .zpath cannot start with '.':   z"path cannot have more than one ':'z$path cannot have '.' to right of ':'z!registered path to %r handler: %rN)	r   r   r   countfindindexr-   logdebug)r   paths     r   r   r      s    6 4  s566
d{::c?QABB99S$**S/*R/CDD JtII14>r   Fc                    t        |       st        | dd      | st        d      | j                  }t	        |       |r||k7  rt        d|d|d      t        j                  |      }|rG|| u rt        j                  d||        y|rt        j                  d	||       nt        d
|d|      | t        |<   t        j                  d||        y)a@  register password hash handler.

    this method immediately registers a handler with the internal passlib registry,
    so that it will be returned by :func:`get_crypt_handler` when requested.

    :arg handler: the password hash handler to register
    :param force: force override of existing handler (defaults to False)
    :param _attr:
        [internal kwd] if specified, ensures ``handler.name``
        matches this value, or raises :exc:`ValueError`.

    :raises TypeError:
        if the specified object does not appear to be a valid handler.

    :raises ValueError:
        if the specified object's name (or other required attributes)
        contain invalid values.

    :raises KeyError:
        if a (different) handler was already registered with
        the same name, and ``force=True`` was not specified.
    zpassword hash handlerr   z``bool(handler)`` must be Truez3handlers must be stored only under their own name (z != )z&same %r handler already registered: %rNz/overriding previously registered %r handler: %rzanother z& handler has already been registered: zregistered %r handler: %r)r   r   AssertionErrorr   r   r   	_handlersgetr   r   warningKeyError)r   forcer   r   others        r   r   r      s    0 G$)@)LL=>> <<D4 $' ( 	( MM$EGII>gNKKIe%  %) * * IdOII)49r   c                    | j                  d      r|t        u rt        d|       |S 	 t        |    S # t        $ r Y nw xY wt	        | t
              sJ d       | j                  dd      j                         }|| k7  r3t        d| d|t        d       |} 	 t        |    S # t        $ r Y nw xY wt        j                  |       }|rxd	|v r|j                  d	      \  }}n|| }}t        ||gd
      }t        j                  |       }|rt        |      sJ d| d|       |S t        ||      }t!        ||        |S |t        u rt        d|       |S )a'  return handler for specified password hash scheme.

    this method looks up a handler for the specified scheme.
    if the handler is not already loaded,
    it checks if the location is known, and loads it first.

    :arg name: name of handler to return
    :param default: optional default value to return if no handler with specified name is found.

    :raises KeyError: if no handler matching that name is found, and no default specified, a KeyError will be raised.

    :returns: handler attached to name, or default value (if specified).
    r   zinvalid handler name: zname must be string instance-zLhandler names should be lower-case, and use underscores instead of hyphens: z =>    )
stacklevelr   r   )fromlistlevelzunexpected object: name=z object=r   z&no crypt handler found for algorithm: )r   _UNSETr   r   
isinstancer   replacer   r   r   r-   r   split
__import__r   getattrr   )r   r   altr   modnamemodattrmodr   s           r   r   r   *  sq     sf?@@N  dN+K-KK
,,s3

%
%
'C
d{'+S23A	 	T?" 		 >>$D$;#zz#GW#TWG
 G9A> --%#G,fX\^e.ffN #w'wd3 &TKLLs    4 	A A B# #	B/.B/c                 r    t        t              }| s|j                  t               t	        d |D              S )zreturn sorted list of all known crypt handler names.

    :param loaded_only: if ``True``, only returns names of handlers which have actually been loaded.

    :returns: list of names of all known handlers
    c              3   D   K   | ]  }|j                  d       r|  yw)r   N)r   .0r   s     r   	<genexpr>z&list_crypt_handlers.<locals>.<genexpr>  s     E40D$Es     )r(   r   r+   r-   r.   )loaded_onlynamess     r   r   r   u  s/     	NEZ  E5EEEr   c                 0    | t         v xs | xr | t        v S )aA  check if handler name is known.

    this is only useful for two cases:

    * quickly checking if handler has already been loaded
    * checking if handler exists, without actually loading it

    :arg name: name of handler
    :param loaded_only: if ``True``, returns False if handler exists but hasn't been loaded
    r   r-   )r   r   s     r   _has_crypt_handlerr     s      IJ{?#Itz7IJr   c                 H    | t         v rt         | = |r| t        v rt        | = yyy)a  unloads a handler from the registry.

    .. warning::

        this is an internal function,
        used only by the unittests.

    if loaded handler is found with specified name, it's removed.
    if path to lazy load handler is found, it's removed.

    missing names are a noop.

    :arg name: name of handler to unload
    :param locations: if False, won't purge registered handler locations (default True)
    Nr   )r   	locationss     r   _unload_handler_namer     s,      ydOTZ't (yr   c                     t        |       r| S t        | t              rt        |       S t	        j
                  | t        |      )z>
    internal helper to resolve argument to hasher object
    )r   r   r   r   r   r   )hasherparams     r   _resolver     s;     	FN	+ ((##FNEBBr   anybuiltinos_cryptc                 <   t        |       } |t        k(  rt        | d      sy	 | j                          yt        | d      r"|r|| j                  vry| j                  |      S |t        k(  ry|ryt	        j                  | |      # t        j
                  $ r Y yw xY w)a  
    Test if specified backend is available for hasher.

    :param hasher:
        Hasher name or object.

    :param backend:
        Name of backend, or ``"any"`` if any backend will do.
        For hashers without multiple backends, will pretend
        they have a single backend named ``"builtin"``.

    :param safe:
        By default, throws error if backend is unknown.
        If ``safe=True``, will just return false value.

    :raises ValueError:
        * if hasher name is unknown.
        * if backend is unknown to hasher, and safe=False.

    :return:
        True if backend available, False if not available,
        and None if unknown + safe=True.
    get_backendTFhas_backendN)
r   ANYhasattrr   r   MissingBackendErrorbackendsr   BUILTINUnknownBackendError)r   backendsafes      r   r   r     s    0 fF#~v}-	 
 v}%G6??2!!'** '	%%fg66! && 		s   B BBc                      t         syt        d t        D              } | sAddl}t	        d|j                         d|j                         dt        j                         | S )zN
    return tuple of schemes which :func:`crypt.crypt` natively supports.
    r$   c              3   \   K   | ]$  }t        |      j                  t              r| & y wr'   )r   r   OS_CRYPTr   s     r   r   z1get_supported_os_crypt_schemes.<locals>.<genexpr>  s,      D4&t,88B  Ds   *,r   Nz]crypt.crypt() function is present, but doesn't support any formats known to passlib! (system=z	 release=r   )	os_crypt_presenttupleos_crypt_schemesplatformr   systemreleaser   PasslibRuntimeWarning)cacher   s     r   get_supported_os_crypt_schemesr      s^    
  D#3 D DEoo!1!1!35 &&	( Lr   c                 6    t         xr t        | t        d      S )a  
    check if hash is supported by native :func:`crypt.crypt` function.
    if :func:`crypt.crypt` is not present, will always return False.

    :param hasher:
        name or hasher object.

    :returns bool:
        True if hash format is supported by OS, else False.
    T)r   )r   r   r   )r   s    r   has_os_crypt_supportr     s     HFH4 HHr   r$   )FN)F)T)r"   )4r4   relogging	getLoggerr1   r   warningsr   passlibr   passlib.excr   r   passlib.ifcr   passlib.utilsr   r	   r   r
   r   passlib.utils.compatr   passlib.utils.decorr   __all__r    r   _proxyr   r,   r   dictr-   compiler   	frozensetr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r$   r   r   <module>r      s   <
 
 'g''1   9 $  0 4&F &R 
	  
 OO	
  P 1P '	P
 6P 'P .P ,P ,P .P )P )P +P 0P +P  -!P" .#P$ .%P& 5'P( 5)P* 3+P, 3-P. 2/P0 11P2 03P4 25P6 #7P8 39P: );P< )=P> *?P@ ,APB ,CPD *EPF 5GPH /IPJ 0KPL .MPN /OPP 6QPR 7SPT 9UPV 9WPX 5YPZ 6[P\ 5]P^ 2_P` 6aPb 8cPd 8ePf 1gPh 3iPj 3kPl (mPn -oPp 'qPr (sPt )uPv )wPx (yPz '{P| (}P~ )P@ )APB ,CPD .EPF .GPH 'IPJ (KPL /MPN 3OPP %QPR 'SPT /UPV 1WPX 1YPZ 5[P\ ,]P^ ,_P
f 2::12  9 : 0(?T3:j %+ IVF K<	C 
 !$% 37|  &Ir   