__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

[email protected]: ~ $
�

�M�gj��
��SrSSKJrJr SSKJr SSKJr SSKrSSK	r	SSK
r
\
R"\5r
SSKJr SSKJr SqSqSqSqSSKJr SS	KJrJrJr SS
KJrJrJrJ r J!r!J"r"J#r#J$r$J%r%J&r&J'r' SSK(J)r) SSK*J+r+ SS
K*J,r,J-r-J.r.J/r/J0r0J1r1 SSK2J3s J4r5 S/r6\,"S5r7\,"S5r8\,"S5r9\,"S5r:\,"S5r;Sr<Sr=Sr>"SS\5R~\5R�\5R�\5R�\5R�\5R�5rE"SS\E5rF"SS\E5rG"SS\E5rH"SS \E5rI"S!S"\E5rJ"S#S$\E5rK"S%S\F\E5rL\,"S&5rM"S'S(\L5rN"S)S*\N5rOg)+z�passlib.bcrypt -- implementation of OpenBSD's BCrypt algorithm.

TODO:

* support 2x and altered-2a hashes?
  http://www.openwall.com/lists/oss-security/2011/06/27/9

* deal with lack of PY3-compatibile c-ext implementation
�)�with_statement�absolute_import)�	b64encode)�sha256N)�metadata)�warn)�compile_hmac)�PasslibHashWarning�PasslibSecurityWarning�PasslibSecurityError)�
safe_crypt�
repeat_string�to_bytes�
parse_version�rng�
getrandstr�
test_crypt�
to_unicode�
utf8_truncate�utf8_repeat_string�crypt_accepts_bytes)�bcrypt64)�get_unbound_method_function)�u�
uascii_to_str�unicode�
str_to_uascii�PY3�
error_from�bcryptz$2$z$2a$z$2x$z$2y$z$2b$�z<$2a$04$5BJqKfqMQvV7nS.yUguNcueVirQqDBGaLXSqj.rs.pZPlNR0UX/HKc�\�SSKnSSKJn g![a gf=f![a gf=f)a�
internal helper which tries to distinguish pybcrypt vs bcrypt.

:returns:
    True if cext-based py-bcrypt,
    False if ffi-based bcrypt,
    None if 'bcrypt' module not found.

.. versionchanged:: 1.6.3

    Now assuming bcrypt installed, unless py-bcrypt explicitly detected.
    Previous releases assumed py-bcrypt by default.

    Making this change since py-bcrypt is (apparently) unmaintained and static,
    whereas bcrypt is being actively maintained, and it's internal structure may shift.
rN)�__version__FT)r �ImportError�bcrypt._bcryptr#)r r#s  �9/usr/lib/python3/dist-packages/passlib/handlers/bcrypt.py�_detect_pybcryptr'8s@��(���.������������s���
��
+�+c	�^�\rSrSrSrSrSrSr\Rr
\r\
\\\\4r\"S5\
\"S5\\"S5\\"S	5\0rS
=rr\RrSrSrS
rSrSrSrSrSrSrSr Sr!\r"Sr#\$S5r%Sr&Sr'\$U4Sj5r(\$S5r)\$U4Sj5r*\$U4Sj5r+SU4Sjjr,Sr-\$S5r.Sr/\$SSj5r0Sr1U=r2$)�
_BcryptCommon�_a
Base class which implements brunt of BCrypt code.
This is then subclassed by the various backends,
to override w/ backend-specific methods.

When a backend is loaded, the bases of the 'bcrypt' class proper
are modified to prepend the correct backend-specific subclass.
r )�salt�rounds�ident�truncate_error��2�2a�2y�2b�z.Oeu���log2�HFc�<�URU5up#U[:Xa[S5eUR[	S55upE[U5nU[	S5U4-:wa [RRUS5eUSSUSSp�U"UUU=(d SUS9$)Nz>crypt_blowfish's buggy '2x' hashes are not currently supported�$z%02dzmalformed cost fieldr4)r,r+�checksumr-)	�_parse_ident�IDENT_2X�
ValueError�splitr�int�uh�exc�MalformedHashError)	�cls�hashr-�tail�
rounds_str�datar,r+�chks	         r&�from_string�_BcryptCommon.from_string�s����&�&�t�,����H���3�4�
4��:�:�a��f�-��
��Z�����6��f�Y�.�.��&�&�+�+�C�1G�H�H���"�I�t�B�C�y�c�����[�D��	
�	
�c��[S5URURURUR4-n[U5$)Nz%s%02d$%s%s)rr-r,r+r;r)�selfrEs  r&�	to_string�_BcryptCommon.to_string�s5�����4�:�:�t�{�{�D�I�I�t�}�}�"U�U���T�"�"rLc�`�[S5XRUR4-n[U5$)z5internal helper to prepare config string for backendsz	%s%02d$%s)rr,r+r)rNr-�configs   r&�_get_config�_BcryptCommon._get_config�s(���;��5�+�+�t�y�y�"A�A���V�$�$rLc��>�[U[5(aURS5nUR[5(aUSUR
;ag[[U]""U40UD6$)N�ascii�T)	�
isinstance�bytes�decode�
startswith�IDENT_2A�final_salt_chars�superr)�needs_update)rDrE�kwds�	__class__s   �r&r_�_BcryptCommon.needs_update�s\���
�d�E�"�"��;�;�w�'�D��?�?�8�$�$��b���9M�9M�)M��
�]�C�5�d�C�d�C�CrLc�p�URU5(aURU5R5$U$)z<helper to normalize hash, correcting any bcrypt padding bits)�identifyrJrO�rDrEs  r&�normhash�_BcryptCommon.normhash�s0���<�<�����?�?�4�(�2�2�4�4��KrLc�T>�[[U]5n[R"U5$�N)r^r)�_generate_saltr�
repair_unused)rDr+ras  �r&rj�_BcryptCommon._generate_salt�s%����]�C�7�9���%�%�d�+�+rLc�>�[[U]
"U40UD6nUcS5e[R"U5up1U(a[S[5 U$)Nz!HasSalt didn't generate new salt!z�encountered a bcrypt salt with incorrectly set padding bits; you may want to use bcrypt.normhash() to fix this; this will be an error under Passlib 2.0)r^r)�
_norm_saltr�check_repair_unusedrr
)rDr+r`�changedras    �r&rn�_BcryptCommon._norm_salt�s\����]�C�3�D�A�D�A����D�!D�D�� �4�4�T�:�
���
�G�#�	
$�
�rLc�>�[[U]XS9n[R"U5up1U(a[S[5 U$)N)�relaxedz�encountered a bcrypt hash with incorrectly set padding bits; you may want to use bcrypt.normhash() to fix this; this will be an error under Passlib 2.0)r^r)�_norm_checksumrrorr
)rNr;rsrpras    �r&rt�_BcryptCommon._norm_checksum�sG������<�X�<�W��$�8�8��B�����G�#�	
$�
�rLz9 -- recommend you install one (e.g. 'pip install bcrypt')c�^^
^^�U[RTLdS5eUR(agURm[[
RR4m[(aT[RR4-
mUUU4SjnUU4SjnUU4Sjm
UU
4SjnSnU"SU5nU[LaSUl[RS	T5 OU(d[S
T-5eU"S[ 5nU[La[ST-5eU(d[ST-5eU"["5 T
"["5(aKTS
:Xa[RST5 O'[%ST-[
RR&5 SUl[ R+SS5nU"SU5nU[LaSUl[RST5 O-U(d[ST-5eU"[.5 U"[.5 [ R+SS5n	U"SU	5nU[LaSUl[RST5 O8U(d[ST-5e[2UlU"[25 U"[25 SUlg)z�
helper called by from backend mixin classes' _load_backend_mixin() --
invoked after backend imports have been loaded, and performs
feature detection & testing common to all backends.
z1_configure_workarounds() invoked from wrong classTc	�>�T"X5$!Ta	 [s$[RRa [RSTXSS9 [s$f=f)z8verify() wrapper which traps 'unknown identifier' errorsz<trapped unexpected response from %r backend: verify(%r, %r):T��exc_info)�NotImplementedrArB�InternalBackendError�log�debug)�secretrE�backend�	err_types�verifys  ���r&�safe_verify�:_BcryptCommon._finalize_backend_mixin.<locals>.safe_verify-s`���
&��f�+�+���	
&�&�%��6�6�.�.�
&��	�	�X�!�6�$��@�%�%�

&�s��A�9A�Ac��>�SnURS5S-nURS5S-nT"X5(a[ST<SU<S35eT"X5(d[T<SU<S	35eg
)a�
helper to check for cryptblowfish 8bit bug (fixed in 2y/2b);
even though it's not known to be present in any of passlib's backends.
this is treated as FATAL, because it can easily result in seriously malformed hashes,
and we can't correct for it ourselves.

test cases from <http://cvsweb.openwall.com/cgi/cvsweb.cgi/Owl/packages/glibc/crypt_blowfish/wrapper.c.diff?r1=1.9;r2=1.10>
reference hash is the incorrectly generated $2x$ hash taken from above url
sёrVs805$6bNw2HLQYeqHYyBfLMsv/OiwqTymGIGzFsA4hOTWebfehXHNprcASs805$6bNw2HLQYeqHYyBfLMsv/OUcZd0LKP39b87nBw3.S2tVZSqiQX6euz.passlib.hash.bcrypt: Your installation of the zM backend is vulnerable to the crypt_blowfish 8-bit bug (CVE-2011-2483) under z@ hashes, and should be upgraded or replaced with another backend� backend failed to verify z
 8bit hashN)�encoder�RuntimeError�r-r~�bug_hash�correct_hashrr�s    ��r&�assert_lacks_8bit_bug�D_BcryptCommon._finalize_backend_mixin.<locals>.assert_lacks_8bit_bugCs����0!�F��|�|�G�,�/j�j�H� �<�<��0�3n�n�L��f�'�'�+�RY�Z_�a�b�b��&�/�/�"�QX�Z_�#`�a�a�0rLc�>�SSSnURS5S-nT"X5(agURS5S-nT"X5(d[T<SU<S	35eg
)a�
check for bsd wraparound bug (fixed in 2b)
this is treated as a warning, because it's rare in the field,
and pybcrypt (as of 2015-7-21) is unpatched, but some people may be stuck with it.

test cases from <http://www.openwall.com/lists/oss-security/2012/01/02/4>

NOTE: reference hash is of password "0"*72

NOTE: if in future we need to deliberately create hashes which have this bug,
      can use something like 'hashpw(repeat_string(secret[:((1+secret) % 256) or 1]), 72)'
s01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789N�rVs804$R1lJ2gkNaoPGdafE.H.16.nVyh2niHsGJhayOHLMiXlI45o8/DU.6Ts804$R1lJ2gkNaoPGdafE.H.16.1MKHPvmKwryeulRe225LKProWYwt9Oir�z wraparound hashF)r�r�r�s    ��r&�detect_wrap_bug�>_BcryptCommon._finalize_backend_mixin.<locals>.detect_wrap_bugmsi���'���-�F��|�|�G�,�/j�j�H��f�'�'��!�<�<��0�3n�n�L��&�/�/�"�W^�`e�#f�g�g�rLc�D>�T"U5(dg[T<SU<35e)Nz- backend unexpectedly has wraparound bug for )r�)r-rr�s ��r&�assert_lacks_wrap_bug�D_BcryptCommon._finalize_backend_mixin.<locals>.assert_lacks_wrap_bug�s%���"�5�)�)���V]�_d�e�f�frLs;$2$04$5BJqKfqMQvV7nS.yUguNcuRfMMOXK0xPWavM7pOzjEi5ze5T1k8/S�testz1%r backend lacks $2$ support, enabling workaroundz %s incorrectly rejected $2$ hashz %s lacks support for $2a$ hashesz!%s incorrectly rejected $2a$ hash�os_cryptz;%r backend has $2a$ bsd wraparound bug, enabling workaroundz�passlib.hash.bcrypt: Your installation of the %r backend is vulnerable to the bsd wraparound bug, and should be upgraded or replaced with another backend (enabling workaround for now).r1r2z2%r backend lacks $2y$ support, enabling workaroundz!%s incorrectly rejected $2y$ hashr3z2%r backend lacks $2b$ support, enabling workaroundz!%s incorrectly rejected $2b$ hash)r �_backend_mixin_map�_workrounds_initializedr�r>rArB�MissingBackendError�	_bcryptor�engine�	SaltErrorrz�_lacks_20_supportr|r}r��TEST_HASH_2Ar\rr�_has_2a_wraparound_bug�replace�_lacks_2y_support�IDENT_2Y�_lacks_2b_support�IDENT_2B�_fallback_ident)
�	mixin_clsr�dryrunr�r�r��test_hash_20�result�test_hash_2y�test_hash_2br�r�r�s
 `        @@@r&�_finalize_backend_mixin�%_BcryptCommon._finalize_backend_mixinsL����F�5�5�g�>�>�	@�?�	@�>��,�,���!�!������!;�!;�<�	��9��)�*�*�4�4�6�6�I�	&�,(	b�T	�6	g�V���V�\�2���^�#�*.�I�'��I�I�I�7�S���A�G�K�L�L�
�V�\�2���^�#��A�G�K�L�L���B�W�L�M�M�!�(�+��x�(�(��j�(��I�I�[�]d�e��:�=D�D����6�6�	8�
48�	�0�
$�+�+�D�$�7���V�\�2���^�#�*.�I�'��I�I�J�G�T���B�W�L�M�M�
"�(�+�!�(�+�$�+�+�D�$�7���V�\�2���^�#�*.�I�'��I�I�J�G�T���B�W�L�M�M�(0�I�%�!�(�+�!�(�+�-1�	�)�rLc�J�URXRURS9$)zj
common helper for backends to implement _calc_checksum().
takes in secret, returns (secret, ident) pair,
)�new)�_norm_digest_argsr-�use_defaults�rNr~s  r&�_prepare_digest_args�"_BcryptCommon._prepare_digest_args�s$��
�%�%�f�j�j�d�>O�>O�%�P�PrLc��URn[U[5(aURS5nOU(aUR	S5 [R"U5 U(aURU5 [U;a[RRU5eUR(a([U5S:�aU(a
[US5nOUSSnU[:XaX4$U[ :Xa UR"(aUR$nX4$U[&:Xa UR((aUR$nX4$U[*:XaGUR,(a3U(a U(a
[/US5nO[1US5nUR$nX4$U[2:Xa[5S5e[7SU-5e![
a SnGNuf=f)N�utf-8Fr�r8z.$2x$ hashes not currently supported by passlibzunexpected ident value: %r)�_require_valid_utf8_bytesrXrr�rZ�UnicodeDecodeErrorrA�validate_secret�_check_truncate_policy�_BNULLrB�NullPasswordErrorr��lenrr\r�r�r�r�r��IDENT_2r�rrr=r��AssertionError)rDr~r-r��require_valid_utf8_bytess     r&r��_BcryptCommon._norm_digest_args�s���$'�#@�#@� ��f�g�&�&��]�]�7�+�F�
%�
1��
�
�g�&�	���6�"���&�&�v�.�
�V���&�&�*�*�3�/�/��%�%�#�f�+��*<�'�'�v�r�2��������H���P�}��M�h�
��$�$�
�+�+��@�}��=�h�
��$�$��+�+��4�}��1�g�
��$�$��/�"4�F�B�!?��!.�v�r�!:���+�+���}���h�
��O�P�P�!�!=��!E�F�F��W&�
1�,1�(�
1�s�F3�3G�G�)F)3�__name__�
__module__�__qualname__�__firstlineno__�__doc__�name�setting_kwds�
checksum_sizer�charmap�checksum_charsr��
default_identr�r\r=r��ident_valuesr�
ident_aliases�
min_salt_size�
max_salt_size�
salt_charsr]�default_rounds�
min_rounds�
max_rounds�rounds_cost�
truncate_sizer�r�r�r�r�r�r��classmethodrJrOrSr_rfrjrnrt�_no_backend_suggestionr�r�r��__static_attributes__�
__classcell__�ras@r&r)r)_s|�����D�@�L�
�M��%�%�N�
�M��X�x��8�D�L��s�V�W�a��g�x�!�D�'�8��t�W�h�(�M�%'�&�M�M��!�!�J���
�N��J��J��K�
�M�$��"���������O� %���
��
�"#�%��D��D�$�����,��,�����	�4Y���C��C�VQ��W��WrLr)c�,^�\rSrSrSrU4SjrSrU=r$)�
_NoBackendiGzt
mixin used before any backend has been loaded.
contains stubs that force loading of one of the available backends.
c�J>�UR5 [[U]U5$ri)�_stub_requires_backendr^r �_calc_checksum)rNr~ras  �r&r��_NoBackend._calc_checksumOs#����#�#�%��V�T�1�&�9�9rLr�)r�r�r�r�r�r�r�r�r�s@r&r�r�Gs����:�:rLr�c�.�\rSrSrSr\S5rSrSrg)�_BcryptBackendi\z%
backend which uses 'bcrypt' package
c��[5(agSSKq[R
"S5n[RSU5 URX5$![a gf=f! [RSSS9 SnNQ=f)	NFrr z&(trapped) error reading bcrypt versionTrx�	<unknown>z%detected 'bcrypt' backend, version %r)
r'r �_bcryptr$r�versionr|�warningr}r�)r�r�r�r�s    r&�_load_backend_mixin�"_BcryptBackend._load_backend_mixinas������	�$�	"��&�&�x�0�G�
	�	�	�9�7�C��0�0��>�>���	��	��	"��K�K�@�4�K�P�!�G�s�A�A$�
A!� A!�$A>c��URU5upURU5n[U[5(aUR	S5n[
R
X5n[U[5(deURU5(a[U5[U5S-:wa[RRXUSS9eUSSRS5$)NrVr/z`bcrypt` package��source���)r�rSrXrr�r��hashpwrYr[r�rArB�CryptBackendErrorrZ�rNr~r-rRrEs     r&r��_BcryptBackend._calc_checksum�s���
�1�1�&�9�
���!�!�%�(���f�g�&�&��]�]�7�+�F��~�~�f�-���$��&�&�&�&����v�&�&�#�d�)�s�6�{�2�~�*E��&�&�*�*�4��FX�*�Y�Y��C�D�z� � ��)�)rLr�N�	r�r�r�r�r�r�r�r�r�r�rLr&r�r�\s!����?��?�J
*rLr�c�.�\rSrSrSr\S5rSrSrg)�_BcryptorBackendi�z'
backend which uses 'bcryptor' package
c�|�SSKqU(d[S[5 URX5$![a gf=f)NrFzqSupport for `bcryptor` is deprecated, and will be removed in Passlib 1.8; Please use `pip install bcrypt` instead)�bcryptorr�r$r�DeprecationWarningr��r�r�r�s   r&r��$_BcryptorBackend._load_backend_mixin�sG��	�(�
��;�<N�
P��0�0��>�>���	��	�s�.�
;�;c�b�URU5upURU5n[RR	S5RX5nUR
U5(a[U5[U5S-:wa[RRXUSS9e[USS5$)NFr/zbcryptor libraryr�r�)r�rSr�r��Engine�hash_keyr[r�rArBr�rr�s     r&r��_BcryptorBackend._calc_checksum�s���
�1�1�&�9�
���!�!�%�(�����&�&�u�-�6�6�v�F�����v�&�&�#�d�)�s�6�{�R�7G�*G��&�&�*�*�4��FX�*�Y�Y��T�#�$�Z�(�(rLr�Nr�r�rLr&r�r��s ����
?��
?�
)rLr�c�<�\rSrSrSrSr\S5rSrSr	\	r
Srg)�_PyBcryptBackendi�z'
backend which uses 'pybcrypt' package
Nc�:�[5(dgSSKqU(d[	S[
5 [RRn[RSU5 [U5=(d S	nUS
:ag[	SU-[RR5 URcSSKnUR#5Ul[%UR&5UlUR+X5$![a gf=f! [RSSS9 SnN�=f)NFrzrSupport for `py-bcrypt` is deprecated, and will be removed in Passlib 1.8; Please use `pip install bcrypt` insteadz((trapped) error reading pybcrypt versionTrxr�z'detected 'pybcrypt' backend, version %r)rr)r�zapy-bcrypt %s has a major security vulnerability, you should upgrade to py-bcrypt 0.3 immediately.)r'r �	_pybcryptr$rr�r�r#r|r�r}rrArBr�
_calc_lock�	threading�Lockr�_calc_checksum_threadsafer�r�)r�r�r�r��vinfors      r&r��$_PyBcryptBackend._load_backend_mixin�s�� �!�!��	�&���;�<N�
P�	"��'�'�3�3�G�	�	�	�;�W�E��g�&�0�&���6�>��D����F�F�9�9�
;��#�#�+� �'0�~�~�'7�	�$�'B�9�Cf�Cf�'g�I�$��0�0��>�>��9�	��	��	"��K�K�B�T�K�R�!�G�s�C0�D�0
C=�<C=�Dc�r�UR URU5sSSS5 $!,(df   g=fri)r�_calc_checksum_rawr�s  r&r�*_PyBcryptBackend._calc_checksum_threadsafe�s#���_�_��*�*�6�2��_�_�s�(�
6c�0�URU5upURU5n[RX5nUR	U5(a[U5[U5S-:wa[RRXUSS9e[USS5$)Nr/zpybcrypt libraryr�r�)
r�rSrr�r[r�rArBr�rr�s     r&r�#_PyBcryptBackend._calc_checksum_raw�s����1�1�&�9�
���!�!�%�(������/�����v�&�&�#�d�)�s�6�{�R�7G�*G��&�&�*�*�4��FX�*�Y�Y��T�#�$�Z�(�(rLr�)r�r�r�r�r�rr�r�rrr�r�r�rLr&rr�s2���
�J��$?��$?�L3�)�(�NrLrc�<�\rSrSrSr\(+r\S5rSr	Sr
g)�_OsCryptBackendiz(
backend which uses :func:`crypt.crypt`
c�P�[S[5(dgURX5$)Nr�F)rr�r�r�s   r&r��#_OsCryptBackend._load_backend_mixins#���&�,�/�/���0�0��>�>rLc��URU5upURU5n[X5nUbVURU5(a[	U5[	U5S-:wa [
RRXU5eUSS$[(a'[U[5(aURS5 [
RRn[
RR!SU"U5<SU"U5<S35e![a* [[
RRS5S5ef=f)Nr/r�r�z�python3 crypt.crypt() ony supports bytes passwords using UTF8; passlib recommends running `pip install bcrypt` for general bcrypt support.z|crypt.crypt() failed for unknown reason; passlib recommends running `pip install bcrypt` for general bcrypt support.(config=z	, secret=�))r�rSr
r[r�rArBr�rrXrYrZr�r�PasswordValueError�debug_only_reprr{)rNr~r-rRrErs      r&r��_OsCryptBackend._calc_checksums��
�1�1�&�9�
���!�!�%�(���&�)�����?�?�6�*�*�c�$�i�3�v�;��;K�.K��f�f�.�.�t�T�B�B����:���3�:�f�e�,�,�
��
�
�g�&�*�&�&�0�0���f�f�)�)�)8��(?��QW�AX�
Z��	��+&�
� ����!:�!:�b�"����
�s�*D	�	4D=r�N)r�r�r�r�r�rr�r�r�r�r�r�rLr&rrs)���%8� 7���?��?�
7rLrc�.�\rSrSrSr\S5rSrSrg)�_BuiltinBackendiPz9
backend which uses passlib's pure-python implementation
c��SSKJn U"[RR	S55(d[
R
S5 gSSKJq	 URX5$)Nr)�as_bool�PASSLIB_BUILTIN_BCRYPTz@bcrypt 'builtin' backend not enabled via $PASSLIB_BUILTIN_BCRYPTF)�
raw_bcrypt)�
passlib.utilsr�os�environ�getr|r}�passlib.crypto._blowfishr�_builtin_bcryptr�)r�r�r�rs    r&r��#_BuiltinBackend._load_backend_mixinTsB��)��r�z�z�~�~�&>�?�@�@��I�I�X�Y��J��0�0��>�>rLc��URU5up[XSSURRS5UR5nURS5$)N����rV)r�r#r+r�r,rZ)rNr~r-rIs    r&r��_BuiltinBackend._calc_checksum^sN���1�1�&�9�
���f�A�b�k�"�i�i�.�.�w�7����F���z�z�'�"�"rLr�Nr�r�rLr&rrPs ����?��?�#rLrc�2�\rSrSrSrSrSr\\\	\
\\S.r
Srg)r iga
This class implements the BCrypt password hash, and follows the :ref:`password-hash-api`.

It supports a fixed-length salt, and a variable number of rounds.

The :meth:`~passlib.ifc.PasswordHash.using` method accepts the following optional keywords:

:type salt: str
:param salt:
    Optional salt string.
    If not specified, one will be autogenerated (this is recommended).
    If specified, it must be 22 characters, drawn from the regexp range ``[./0-9A-Za-z]``.

:type rounds: int
:param rounds:
    Optional number of rounds to use.
    Defaults to 12, must be between 4 and 31, inclusive.
    This value is logarithmic, the actual number of iterations used will be :samp:`2**{rounds}`
    -- increasing the rounds by +1 will double the amount of time taken.

:type ident: str
:param ident:
    Specifies which version of the BCrypt algorithm will be used when creating a new hash.
    Typically this option is not needed, as the default (``"2b"``) is usually the correct choice.
    If specified, it must be one of the following:

    * ``"2"`` - the first revision of BCrypt, which suffers from a minor security flaw and is generally not used anymore.
    * ``"2a"`` - some implementations suffered from rare security flaws, replaced by 2b.
    * ``"2y"`` - format specific to the *crypt_blowfish* BCrypt implementation,
      identical to ``"2b"`` in all but name.
    * ``"2b"`` - latest revision of the official BCrypt algorithm, current default.

:param bool truncate_error:
    By default, BCrypt will silently truncate passwords larger than 72 bytes.
    Setting ``truncate_error=True`` will cause :meth:`~passlib.ifc.PasswordHash.hash`
    to raise a :exc:`~passlib.exc.PasswordTruncateError` instead.

    .. versionadded:: 1.7

:type relaxed: bool
:param relaxed:
    By default, providing an invalid value for one of the other
    keywords will result in a :exc:`ValueError`. If ``relaxed=True``,
    and the error can be corrected, a :exc:`~passlib.exc.PasslibHashWarning`
    will be issued instead. Correctable errors include ``rounds``
    that are too small or too large, and ``salt`` strings that are too long.

    .. versionadded:: 1.6

.. versionchanged:: 1.6
    This class now supports ``"2y"`` hashes, and recognizes
    (but does not support) the broken ``"2x"`` hashes.
    (see the :ref:`crypt_blowfish bug <crypt-blowfish-bug>`
    for details).

.. versionchanged:: 1.6
    Added a pure-python backend.

.. versionchanged:: 1.6.3

    Added support for ``"2b"`` variant.

.. versionchanged:: 1.7

    Now defaults to ``"2b"`` variant.
)r �pybcryptr�r��builtinT)Nr r*r�r�r+r�N)r�r�r�r�r��backends�_backend_mixin_targetr�r�rr�rrr�r�r�rLr&r r gs5��@�VI�H�!��� �$�$�#�"�
�rLr:c�^�\rSrSrSr\"S\R55rSr\	S5r
Srg)�_wrapped_bcrypti�z�
abstracts out some bits bcrypt_sha256 & django_bcrypt_sha256 share.
- bypass backend-loading wrappers for hash() etc
- disable truncation support, sha256 wrappers don't need it.
c#�4# �UHoS;dM
Uv� M g7f))r.Nr�)�.0�elems  r&�	<genexpr>�_wrapped_bcrypt.<genexpr>�s���`�*=�$�M_�A_���*=�s�	�	Nc��grir�)rDr~s  r&r��&_wrapped_bcrypt._check_truncate_policy�s��	
rLr�)r�r�r�r�r��tupler r�r�r�r�r�r�rLr&r/r/�s8���
�`�&�*=�*=�`�`�L��M�&�
��
rLr/c�J^�\rSrSrSrSr\\4rS"\5r	\r
\"SS/5rSr
\SU4Sjj5r\"S5r\R&"S5r\R&"S	5r\S
5r\S5r\"S5r\"S
5rSrSU4Sjjr\S5rU4SjrU4SjrSrU=r $)�
bcrypt_sha256i�a�
This class implements a composition of BCrypt + HMAC_SHA256,
and follows the :ref:`password-hash-api`.

It supports a fixed-length salt, and a variable number of rounds.

The :meth:`~passlib.ifc.PasswordHash.hash` and :meth:`~passlib.ifc.PasswordHash.genconfig` methods accept
all the same optional keywords as the base :class:`bcrypt` hash.

.. versionadded:: 1.6.2

.. versionchanged:: 1.7

    Now defaults to ``"2b"`` bcrypt variant; though supports older hashes
    generated using the ``"2a"`` bcrypt variant.

.. versionchanged:: 1.7.3

    For increased security, updated to use HMAC-SHA256 instead of plain SHA256.
    Now only supports the ``"2b"`` bcrypt variant.  Hash format updated to "v=2".
c�f^�[U4Sj[RR555$)Nc3�>># �UHnUST;dMUv� M g7f)r&Nr�)r1�itemr�s  �r&r3�)bcrypt_sha256.<lambda>.<locals>.<genexpr>s'����/K�@\��26�q�'�\�2I�04�t�@\�s�
�	)�dictr r��items)r�s`r&�<lambda>�bcrypt_sha256.<lambda>s(���$�/K��@T�@T�@Z�@Z�@\�/K�+KrLr&�c��>�[[U]
"S0UD6nUbURU5UlUR
nURS:�a'U[:wa[SU<SUR<35eU$)Nr&zbcrypt z  hashes not allowed for version r�)r^r9�using�
_norm_versionr�r�r�r>)rDr�r`�subclsr-ras     �r&rD�bcrypt_sha256.using-sm����}�c�0�8�4�8����#�1�1�'�:�F�N��$�$���>�>�A��%�8�"3��#�V�^�^�5�6�
6��
rLz$bcrypt-sha256$z�(?x)
        ^
        [$]bcrypt-sha256[$]
        v=(?P<version>\d+),
        t=(?P<type>2b),
        r=(?P<rounds>\d{1,2})
        [$](?P<salt>[^$]{22})
        (?:[$](?P<digest>[^$]{31}))?
        $
        z�(?x)
        ^
        [$]bcrypt-sha256[$]
        (?P<type>2[ab]),
        (?P<rounds>\d{1,2})
        [$](?P<salt>[^$]{22})
        (?:[$](?P<digest>[^$]{31}))?
        $
        c�t�[R"U5nU(dgURUR5$)NF)rA�to_unicode_for_identifyr[�prefixres  r&rd�bcrypt_sha256.identifybs+���)�)�$�/�������s�z�z�*�*rLc	�6�[USS5nURUR5(d[RRU5eURRU5nU(a@[URS55nUS:a[RRU5eODURRU5nU(aSnO[RRU5eURS5nUR[R5(a3U[R:wa[RRU5eU"UURS5[U5URS5URS	5S
9$)NrVrEr�rBr&r,�typer+�digest)r�r-r,r+r;)rr[rJrArB�InvalidHashError�_v2_hash_re�matchr@�grouprC�_v1_hash_re�_UZERO�ZeroPaddedRoundsError)rDrE�mr�r,s     r&rJ�bcrypt_sha256.from_stringis2���$���0�����s�z�z�*�*��&�&�)�)�#�.�.��O�O�!�!�$�'����!�'�'�)�,�-�G���{��f�f�/�/��4�4�����%�%�d�+�A�����f�f�/�/��4�4�����"�����R�Y�Y�'�'�F�b�i�i�,?��&�&�.�.�s�3�3����'�'�&�/��v�;�������W�W�X�&�
�	
rLz"$bcrypt-sha256$v=2,t=%s,r=%d$%s$%sz$bcrypt-sha256$%s,%d$%s$%sc���URS:Xa
URnOURnXRR	[
5URURUR4-n[U5$)Nr&)
r��_v1_template�_v2_templater-�strip�_UDOLLARr,r+r;r)rN�templaterEs   r&rO�bcrypt_sha256.to_string�s[���<�<�1���(�(�H��(�(�H��:�:�+�+�H�5�t�{�{�D�I�I�t�}�}�]�]���T�"�"rLc�`>�UbURU5Ul[[U]"S0UD6 g)Nr�)rEr�r^r9�__init__)rNr�r`ras   �r&r`�bcrypt_sha256.__init__�s-������-�-�g�6�D�L�
�m�T�+�3�d�3rLc�\�XR;a[UR<SU<35eU$)Nz": unknown or unsupported version: )�_supported_versionsr>r�)rDr�s  r&rE�bcrypt_sha256._norm_version�s(���1�1�1�����SZ�[�\�\��rLc�v>�[U[5(aURS5nURS:Xa[	U5R5nOKURnUSUR;a[S5e[SURS55"U5n[U5n[[U]7U5$)Nr�r&r'zinvalid salt stringrrV)rXrr�r�rrNr+r]r>r	rr^r9r�)rNr~rNr+�keyras     �r&r��bcrypt_sha256._calc_checksum�s�����f�g�&�&��]�]�7�+�F��<�<�1���F�^�*�*�,�F��9�9�D��B�x�t�4�4�4�!�!6�7�7�!�(�D�K�K��,@�A�&�I�F������]�D�8��=�=rLc�t>�UR[U5R:ag[[U]"S0UD6$)NTr�)r�rMr^r9�_calc_needs_update)rNr`ras  �r&ri� bcrypt_sha256._calc_needs_update�s1����<�<�$�t�*�,�,�,���]�D�<�D�t�D�DrL)r�ri)!r�r�r�r�r�r�r\r�r�r�r��setrcr�r�rDrrJ�re�compilerPrSrdrJrZrYrOr`rEr�rir�r�r�s@r&r9r9�s����8�D��h�'�L�K�LX�Z�M��M��q�!�f�+���G�����6� �
!�F��*�*�	�	
�K��*�*��
�K��+��+��
��
�4�9�:�L��1�2�L�#�4�����%>�VE�ErLr9)Pr��
__future__rr�base64r�hashlibrrrl�logging�	getLoggerr�r|�	importlibr�warningsrr�rr�r#�passlib.crypto.digestr	�passlib.excr
rrrr
rrrrrrrrrr�passlib.utils.binaryr�passlib.utils.compatrrrrrrr�passlib.utils.handlers�utils�handlersrA�__all__r�r\r=r�r�r�r�r'�SubclassBackendMixin�
TruncateMixin�
HasManyIdents�	HasRounds�HasSalt�GenericHandlerr)r�r�r�rrrr r\r/r9r�rLr&�<module>r�s����7���	�	��g�'�'��1����
���	��	���.�X�X�Q�Q�Q�Q�*�<�Z�Z�#�#�
����E�(���V�9���V�9���V�9���V�9��	��N��"�Nc�B�+�+�R�-=�-=�r�?O�?O��L�L�"�*�*�b�.?�.?�c�P:��:�*8*�]�8*�z)�}�)�HC(�}�C(�PF�m�F�V#�m�#�.Y�Z��Y�D
�S�6��
�f�
�FdE�O�dErL

Filemanager

Name Type Size Permission Actions
__init__.cpython-313.pyc File 250 B 0644
argon2.cpython-313.pyc File 29.75 KB 0644
bcrypt.cpython-313.pyc File 38.25 KB 0644
cisco.cpython-313.pyc File 12.55 KB 0644
des_crypt.cpython-313.pyc File 20.36 KB 0644
digests.cpython-313.pyc File 6.2 KB 0644
django.cpython-313.pyc File 20.54 KB 0644
fshp.cpython-313.pyc File 7.61 KB 0644
ldap_digests.cpython-313.pyc File 13.81 KB 0644
md5_crypt.cpython-313.pyc File 8.95 KB 0644
misc.cpython-313.pyc File 11.23 KB 0644
mssql.cpython-313.pyc File 9.08 KB 0644
mysql.cpython-313.pyc File 4.29 KB 0644
oracle.cpython-313.pyc File 6.42 KB 0644
pbkdf2.cpython-313.pyc File 17.2 KB 0644
phpass.cpython-313.pyc File 4.8 KB 0644
postgres.cpython-313.pyc File 2.03 KB 0644
roundup.cpython-313.pyc File 886 B 0644
scram.cpython-313.pyc File 14.6 KB 0644
scrypt.cpython-313.pyc File 12.57 KB 0644
sha1_crypt.cpython-313.pyc File 5.76 KB 0644
sha2_crypt.cpython-313.pyc File 15.02 KB 0644
sun_md5_crypt.cpython-313.pyc File 11.85 KB 0644
windows.cpython-313.pyc File 10.9 KB 0644
Filemanager