online :ˆl–ßi~”jj"T%õÆY¸Ó*bÑ¿É „uÀ4a–Ãa¾”*j"Tâ€fàq·Å£Ç?÷a fŸWc‹ªã@sŠdZddlmZddlZddlZe e¡ZddlZddl Z ddl m Z ddl m Z ddlmZmZmZddlmZmZddlmZmZmZmZmZmZmZmZdd lm Z dd l!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,dd l-m.Z.m/Z/gd ¢Z0e1ƒZ2d d„Z3e4dgƒZ5e6e7e7e7e3e7d�Z8dd„Z9e:d dd„ƒZ;e4ddgƒZGdd„de1ƒZ?Gdd„de1ƒZ@Gdd„de@ƒZAdS)!z-passlib.context - CryptContext implementationé)Úwith_statementN)Úwarn)Úexc)ÚExpectedStringErrorÚExpectedTypeErrorÚPasslibConfigWarning)Úget_crypt_handlerÚ_validate_handler_name)ÚhandlersÚto_bytesÚ to_unicodeÚ splitcommaÚas_boolÚtimerÚrngÚ getrandstr)Ú BASE64_CHARS) Ú iteritemsÚ num_typesÚirangeÚPY2ÚPY3ÚunicodeÚSafeConfigParserÚNativeStringIOÚBytesIOÚunicode_or_bytes_typesÚnative_string_types)Údeprecated_methodÚmemoized_property)Ú CryptContextÚLazyCryptContextÚ CryptPolicycCsF| d¡rt| d¡ƒdSz t|ƒWSty@t|ƒYS0dS)z>parse vary_rounds string to percent as [0,1) float, or integerú%ç{®Gáz„?N)ÚendswithÚfloatÚrstripÚintÚ ValueError©Úvalue©r,ú3/usr/lib/python3.9/site-packages/passlib/context.pyÚ_coerce_vary_rounds*s    r.Zsalt)Z min_roundsZ max_roundsZdefault_roundsÚ vary_roundsZ salt_sizecCst|jdƒ|uS)z3detect if handler is registered or a custom handlerN)rÚname©Úhandlerr,r,r-Ú_is_handler_registeredCsr3cCsdS)z dummy function patched into handler.needs_update() by _CryptConfig when hash alg has been deprecated for context. Tr,)ÚhashÚsecretr,r,r-Ú_always_needs_updateGsr6Ztruncate_errorr/zaThe CryptPolicy class has been deprecated as of Passlib 1.6, and will be removed in Passlib 1.8. c@sÊeZdZdZed)dd„ƒZed*dd„ƒZed+d d „ƒZed,d d „ƒZd d„Z dZ dZ dd„Z dd„Z dd„Zd-dd„Zd.dd„Zd/dd„Zd0dd„Zd1dd „Zd2d!d"„Zd3d#d$„Zd4d%d&„Zd5d'd(„ZdS)6r"a .. deprecated:: 1.6 This class has been deprecated, and will be removed in Passlib 1.8. All of its functionality has been rolled into :class:`CryptContext`. This class previously stored the configuration options for the CryptContext class. In the interest of interface simplification, all of this class' functionality has been rolled into the CryptContext class itself. The documentation for this class is now focused on documenting how to migrate to the new api. Additionally, where possible, the deprecation warnings issued by the CryptPolicy methods will list the replacement call that should be used. Constructors ============ CryptPolicy objects can be constructed directly using any of the keywords accepted by :class:`CryptContext`. Direct uses of the :class:`!CryptPolicy` constructor should either pass the keywords directly into the CryptContext constructor, or to :meth:`CryptContext.update` if the policy object was being used to update an existing context object. In addition to passing in keywords directly, CryptPolicy objects can be constructed by the following methods: .. automethod:: from_path .. automethod:: from_string .. automethod:: from_source .. automethod:: from_sources .. automethod:: replace Introspection ============= All of the informational methods provided by this class have been deprecated by identical or similar methods in the :class:`CryptContext` class: .. automethod:: has_schemes .. automethod:: schemes .. automethod:: iter_handlers .. automethod:: get_handler .. automethod:: get_options .. automethod:: handler_is_deprecated .. automethod:: get_min_verify_time Exporting ========= .. automethod:: iter_config .. automethod:: to_dict