+
    ¢THi|@  ã                   óê  € R t ^ RIt^ RIHt ^ RIHu Ht ^ RIH	t	 ^ RI
Ht ^ RIHtHt . ROtR
tR tR tR tR t ! R R]P*                  ]P,                  ]P.                  ]P0                  4      t ! R R]P,                  ]P4                  ]P.                  ]P0                  4      t ! R R]P.                  ]P0                  4      t ! R R	]P*                  ]P.                  ]P0                  4      tR# )z)traditional unix (DES) crypt and variantsN)Úwarn)Údes_encrypt_int_block©Ú
to_unicode)Úh64Úh64bigÚ	des_cryptÚ
bsdi_cryptÚbigcryptÚcrypt16ó    c                óF   € \        R \        V R,          4       4       4      # )zÈconvert secret to 64-bit DES key.

this only uses the first 8 bytes of the secret,
and discards the high 8th bit of each byte at that.
a null parity bit is inserted after every 7th bit of the output.
c              3   ób   "  € T F%  w  rV^,          ^9V^,          ,
          ,          x € K'  	  R# 5i)é   N© )Ú.0ÚiÚcs   &  Ú</usr/lib/python3/dist-packages/passlib/handlers/des_crypt.pyÚ	<genexpr>Ú'_crypt_secret_to_key.<locals>.<genexpr>!   s(   é € ÐLÑ6K©d¨a��D•˜b 1 q¥5�j×)Ò)Ó6Kùs   ‚-/:Né   N)ÚsumÚ	enumerate)Úsecrets   &r   Ú_crypt_secret_to_keyr      s   € ô ÑL´iÀÀrÅ
Ô6KÓLÓLÐLó    c                óŠ  € \        V4      ^8X  g   Q h\        P                  ! V4      p\        V \        4      '       d   V P                  R4      p \        V \        4      '       g   Q h\        V 9   d$   \        P                  P                  \        4      h\        V 4      p\        V^ V^4      p\        P                  ! V4      # )z pure-python backed for des_cryptúutf-8)Úlenr   Údecode_int12Ú
isinstanceÚstrÚencodeÚbytesÚ_BNULLÚuhÚexcÚNullPasswordErrorr   r   r   r   Úencode_int64)r   ÚsaltÚ
salt_valueÚ	key_valueÚresults   &&   r   Ú_raw_des_cryptr.   $   s¤   € äˆt‹9˜Œ>Ðˆ>ô ×!Ò! $Ó'€Jô �&œ#×ÒØ—‘˜wÓ'ˆÜ�fœe×$Ò$Ð$Ð$ô �ÔÜ�f‰f×&Ñ&¤yÓ1Ð1ô % VÓ,€Iô # 9¨a°¸RÓ@€Fô ×Ò˜vÓ&Ð&r   c                óš   € \        V 4      p^p\        V 4      pW#8  d-   V^,           p\        WV 4      p\        W4      V,          pTpK2  V# )z,convert secret to DES key used by bsdi_crypt)r   r   r   )r   r,   ÚidxÚendÚnextÚ	tmp_values   &     r   Ú_bsdi_secret_to_keyr4   C   sQ   € ä$ VÓ,€IØ
€CÜ
ˆf‹+€CØ
Œ)Ø�Q�wˆÜ(¨°DÐ)9Ó:ˆ	Ü)¨)Ó?À)ÕKˆ	ØŠØÐr   c                ód  € \         P                  ! V4      p\        V \        4      '       d   V P	                  R4      p \        V \
        4      '       g   Q h\        V 9   d$   \        P                  P                  \        4      h\        V 4      p\        V^ W14      p\        P                  ! V4      # )z"pure-python backend for bsdi_cryptr   )r   Údecode_int24r!   r"   r#   r$   r%   r&   r'   r(   r	   r4   r   r   r)   )r   Úroundsr*   r+   r,   r-   s   &&&   r   Ú_raw_bsdi_cryptr8   P   s’   € ô ×!Ò! $Ó'€Jô �&œ#×ÒØ—‘˜wÓ'ˆÜ�fœe×$Ò$Ð$Ð$ô �ÔÜ�f‰f×&Ñ&¤zÓ2Ð2ô $ FÓ+€Iô # 9¨a°ÓD€Fô ×Ò˜vÓ&Ð&r   c                   óþ   a € ] tR t^it o RtR tR
t]P                  t	^t
^;tt]P                  t^t]P                   ! R]P"                  ]P$                  ,          4      t]R 4       tR tR tRt]R 4       tR tRtV tR	# )r   aG  This class implements the des-crypt password hash, and follows the :ref:`password-hash-api`.

It supports a fixed-length salt.

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 2 characters, drawn from the regexp range ``[./0-9A-Za-z]``.

:param bool truncate_error:
    By default, des_crypt will silently truncate passwords larger than 8 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
    ``salt`` strings that are too long.

    .. versionadded:: 1.6
zU
        ^
        (?P<salt>[./a-z0-9]{2})
        (?P<chk>[./a-z0-9]{11})?
        $c                ód   € \        VR R4      pVR,          VR,          r2T ! Y#;'       g    RR7      # )ÚasciiÚhash:Né   N:r=   NNN©r*   Úchecksumr   )Úclsr<   r*   Úchks   &&  r   Úfrom_stringÚdes_crypt.from_string©   s0   € ä˜$ ¨Ó0ˆØ˜•H˜d 2�hˆcÙ˜§{ {¨dÔ3Ð3r   c                ó6   € V P                    V P                   2# ©Nr>   ©Úselfs   &r   Ú	to_stringÚdes_crypt.to_string¯   ó   € Ø—)‘)�˜TŸ]™]˜OÐ,Ð,r   c                ój   € V P                   '       d   V P                  V4       V P                  V4      # rE   )Úuse_defaultsÚ_check_truncate_policyÚ_calc_checksum_backend©rG   r   s   &&r   Ú_calc_checksumÚdes_crypt._calc_checksum²   s-   € à××ÐØ×'Ñ'¨Ô/à×*Ñ*¨6Ó2Ð2r   c                ó<   € V P                  V P                  4       R # ©T©Ú_set_calc_checksum_backendÚ_calc_checksum_builtin©r@   s   &r   Ú_load_backend_builtinÚdes_crypt._load_backend_builtin¾   ó   € à×&Ñ& s×'AÑ'AÔBÙr   c                óh   € \        WP                  P                  R 4      4      P                  R 4      # ©r;   )r.   r*   r#   ÚdecoderO   s   &&r   rV   Ú des_crypt._calc_checksum_builtinÃ   s'   € Ü˜f§i¡i×&6Ñ&6°wÓ&?Ó@×GÑGÈÓPÐPr   r   N©r*   Útruncate_error©Úbuiltin)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__ÚnameÚsetting_kwdsr&   ÚHASH64_CHARSÚchecksum_charsÚchecksum_sizeÚmin_salt_sizeÚmax_salt_sizeÚ
salt_charsÚtruncate_sizeÚreÚcompileÚVERBOSEÚ
IGNORECASEÚ_hash_regexÚclassmethodrB   rH   rP   ÚbackendsrX   rV   Ú__static_attributes__Ú__classdictcell__©Ú__classdict__s   @r   r   r   i   s¯   ø‡ € ñðB €DØ-€Lð
 —_‘_€NØ€Mð
 %&Ð%€M�MØ—‘€Jð
 €Mð —*’*ð	ð
 	�
‰
�R—]‘]Õ"ó€Kð ñ4ó ð4ò
-ò3ð €Hð
 ñó ð÷Qð Qr   c                   óF  a a€ ] tR t^Çt oRtR tRt^t]P                  t
^;tt]P                  tRt^tRtRt]P&                  ! R]P(                  ]P*                  ,          4      t]R 4       tR tRt]V 3R	 l4       t]V 3R
 l4       tV 3R ltRt]R 4       tR t Rt!Vt"V ;t## )r	   a®  This class implements the BSDi-Crypt 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 4 characters, drawn from the regexp range ``[./0-9A-Za-z]``.

:type rounds: int
:param rounds:
    Optional number of rounds to use.
    Defaults to 5001, must be between 1 and 16777215, inclusive.

: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
    :meth:`hash` will now issue a warning if an even number of rounds is used
    (see :ref:`bsdi-crypt-security-issues` regarding weak DES keys).
i‰  iÿÿÿ Úlinearz�
        ^
        _
        (?P<rounds>[./a-z0-9]{4})
        (?P<salt>[./a-z0-9]{4})
        (?P<chk>[./a-z0-9]{11})?
        $c                ó(  € \        VR R4      pV P                  P                  V4      pV'       g    \        P                  P                  V 4      hVP                  RRR4      w  r4pV ! \        P                  ! VP                  R 4      4      VVR7      # )r;   r<   r7   r*   rA   )r7   r*   r?   )
r   ru   Úmatchr&   r'   ÚInvalidHashErrorÚgroupr   r6   r#   )r@   r<   Úmr7   r*   rA   s   &&    r   rB   Úbsdi_crypt.from_string  s}   € ä˜$ ¨Ó0ˆØ�O‰O×!Ñ! $Ó'ˆßÜ—&‘&×)Ñ)¨#Ó.Ð.ØŸG™G H¨f°eÓ<Ñˆ�cÙÜ×#Ò# F§M¡M°'Ó$:Ó;ØØô
ð 	
r   c                óª   € R P                  \        P                  ! V P                  4      P	                  R4      V P
                  V P                  4      # )z_{}{}{}r;   )Úformatr   Úencode_int24r7   r]   r*   r?   rF   s   &r   rH   Úbsdi_crypt.to_string  s@   € Ø×ÑÜ×Ò˜TŸ[™[Ó)×0Ñ0°Ó9Ø�I‰IØ�M‰Mó
ð 	
r   Tc                ó¢   <€ \         SV `  ! R/ VB pVP                  ^,          '       g%   \        R\        P
                  P                  4       V# )é   zHbsdi_crypt rounds should be odd, as even rounds may reveal weak DES keysr   )ÚsuperÚusingÚdefault_roundsr   r&   r'   ÚPasslibSecurityWarning)r@   ÚkwdsÚsubclsÚ	__class__s   &, €r   r‹   Úbsdi_crypt.using  sD   ø€ ä‘’Ñ& Ñ&ˆØ×$Ñ$ q×(Ô(äØZÜ—‘×-Ñ-ôð ˆr   c                ó2   <€ \         SV `  4       pV^,          # )r‰   )rŠ   Ú_generate_rounds)r@   r7   r�   s   & €r   r“   Úbsdi_crypt._generate_rounds(  s   ø€ ä‘Ñ)Ó+ˆð ˜�zÐr   c                óZ   <€ V P                   ^,          '       g   R# \        SV `  ! R/ VB # )r‰   Tr   )r7   rŠ   Ú_calc_needs_update)rG   rŽ   r�   s   &,€r   r–   Úbsdi_crypt._calc_needs_update2  s&   ø€ à�{‰{˜Q�ŒÙä‰wÒ)Ñ1¨DÑ1Ð1r   c                ó<   € V P                  V P                  4       R # rS   rT   rW   s   &r   rX   Ú bsdi_crypt._load_backend_builtin>  rZ   r   c                ó~   € \        WP                  V P                  P                  R 4      4      P	                  R 4      # r\   )r8   r7   r*   r#   r]   rO   s   &&r   rV   Ú!bsdi_crypt._calc_checksum_builtinC  s2   € Ü˜v§{¡{°D·I±I×4DÑ4DÀWÓ4MÓN×UÑUØó
ð 	
r   r   )r*   r7   ra   )$rc   rd   re   rf   rg   rh   ri   rl   r&   rj   rk   rm   rn   ro   rŒ   Ú
min_roundsÚ
max_roundsÚrounds_costrq   rr   rs   rt   ru   rv   rB   rH   Ú_avoid_even_roundsr‹   r“   r–   rw   rX   rV   rx   ry   Ú__classcell__©r�   r{   s   @@r   r	   r	   Ç   sè   ù‡ € ñðB €DØ%€LØ€MØ—_‘_€Nð %&Ð%€M�MØ—‘€Jð €NØ€JØ€JØ€Kð —*’*ð	ð 	�
‰
�R—]‘]Õ"ó	€Kð ñ

ó ð

ò
ð Ðàôó ðð ôó ðõ2ð €Hð
 ñó ð÷
ò 
r   c                   óò   a a€ ] tR tRt oRtR tR	t]P                  t	^;t
t]P                  t]P                  ! R]P                  ]P                   ,          4      t]R 4       tR tR
V 3R lltR tRtVtV ;t# )r
   iI  a'  This class implements the BigCrypt password hash, and follows the :ref:`password-hash-api`.

It supports a fixed-length salt.

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 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
    ``salt`` strings that are too long.

    .. versionadded:: 1.6
zX
        ^
        (?P<salt>[./a-z0-9]{2})
        (?P<chk>([./a-z0-9]{11})+)?
        $c                óÚ   € \        VR R4      pV P                  P                  V4      pV'       g    \        P                  P                  V 4      hVP                  RR4      w  r4V ! W4R7      # ©r;   r<   r*   rA   r>   ©r   ru   r   r&   r'   r€   r�   ©r@   r<   r‚   r*   rA   s   &&   r   rB   Úbigcrypt.from_strings  óY   € ä˜$ ¨Ó0ˆØ�O‰O×!Ñ! $Ó'ˆßÜ—&‘&×)Ñ)¨#Ó.Ð.Ø—G‘G˜F EÓ*‰	ˆÙ˜Ô+Ð+r   c                ó6   € V P                    V P                   2# rE   r>   rF   s   &r   rH   Úbigcrypt.to_string|  rJ   r   c                ó–   <€ \         SV `  WR 7      p\        V4      ^,          '       d    \        P                  P                  V 4      hV# ))Úrelaxed)rŠ   Ú_norm_checksumr   r&   r'   r€   )rG   r?   r¬   r�   s   &&&€r   r­   Úbigcrypt._norm_checksum  s>   ø€ Ü‘7Ñ)¨(Ð)ÓDˆÜˆx‹=˜2×ÔÜ—&‘&×)Ñ)¨$Ó/Ð/Øˆr   c                ó*  € \        V\        4      '       d   VP                  R 4      p\        WP                  P                  R4      4      p^p\        V4      pW48  d&   V^,           pV\        WV VRR 4      ,          pTpK+  VP                  R4      # )r   r;   iõÿÿÿi÷ÿÿÿ)r!   r"   r#   r.   r*   r   r]   )rG   r   rA   r0   r1   r2   s   &&    r   rP   Úbigcrypt._calc_checksum…  s‚   € Ü�fœc×"Ò"Ø—]‘] 7Ó+ˆFÜ˜V§Y¡Y×%5Ñ%5°gÓ%>Ó?ˆØˆÜ�&‹kˆØŒiØ˜•7ˆDØ”> &¨TÐ"2°C¸¸B°KÓ@Õ@ˆCØŠCØ�z‰z˜'Ó"Ð"r   r   )r*   )F)rc   rd   re   rf   rg   rh   ri   r&   rj   rk   rm   rn   ro   rq   rr   rs   rt   ru   rv   rB   rH   r­   rP   rx   ry   r    r¡   s   @@r   r
   r
   I  s�   ù‡ € ñð0 €DØ€LØ—_‘_€Nð %&Ð%€M�MØ—‘€JØ—*’*ð	ð
 	�
‰
�R—]‘]Õ"ó€Kð ñ,ó ð,ò-÷÷
#ò 
#r   c                   óä   a € ] tR tRt o RtR tR	t^t]P                  t
^;tt]P                  t^t]P                   ! R]P"                  ]P$                  ,          4      t]R 4       tR tR tRtV tR# )
r   i’  aD  This class implements the crypt16 password hash, and follows the :ref:`password-hash-api`.

It supports a fixed-length salt.

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 2 characters, drawn from the regexp range ``[./0-9A-Za-z]``.

:param bool truncate_error:
    By default, crypt16 will silently truncate passwords larger than 16 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
    ``salt`` strings that are too long.

    .. versionadded:: 1.6
zU
        ^
        (?P<salt>[./a-z0-9]{2})
        (?P<chk>[./a-z0-9]{22})?
        $c                óÚ   € \        VR R4      pV P                  P                  V4      pV'       g    \        P                  P                  V 4      hVP                  RR4      w  r4V ! W4R7      # r¤   r¥   r¦   s   &&   r   rB   Úcrypt16.from_stringÐ  r¨   r   c                ó6   € V P                    V P                   2# rE   r>   rF   s   &r   rH   Úcrypt16.to_stringÙ  rJ   r   c                ó"  € \        V\        4      '       d   VP                  R 4      pV P                  '       d   V P	                  V4        \
        P                  ! V P                  P                  R4      4      p\        T4      p\        T^ T^4      p\        TR,          4      p\        T^ T^4      p\        P                  ! T4      \        P                  ! T4      ,           pTP                  R4      #   \         d    \        R4      Rhi ; i)r   r;   zinvalid chars in saltN:r   é   N)r!   r"   r#   rL   rM   r   r    r*   Ú
ValueErrorr   r   r   r)   r]   )rG   r   r+   Úkey1Úresult1Úkey2Úresult2rA   s   &&      r   rP   Úcrypt16._calc_checksumÜ  sð   € Ü�fœc×"Ò"Ø—]‘] 7Ó+ˆFð ××ÐØ×'Ñ'¨Ô/ð	@Ü×)Ò)¨$¯)©)×*:Ñ*:¸7Ó*CÓDˆJô
 $ FÓ+ˆô (¨¨a°¸RÓ@ˆô $ F¨4¥LÓ1ˆô (¨¨a°¸QÓ?ˆô ×!Ò! 'Ó*¬V×-@Ò-@ÀÓ-IÕIˆØ�z‰z˜'Ó"Ð"øô# ô 	@ÜÐ4Ó5¸4Ð?ð	@ús   Á/C6 Ã6Dr   Nr_   )rc   rd   re   rf   rg   rh   ri   rl   r&   rj   rk   rm   rn   ro   rp   rq   rr   rs   rt   ru   rv   rB   rH   rP   rx   ry   rz   s   @r   r   r   ’  s‹   ø‡ € ñðB €DØ-€Lð
 €MØ—_‘_€Nð
 %&Ð%€M�MØ—‘€Jð
 €MØ—*’*ð	ð
 	�
‰
�R—]‘]Õ"ó€Kð ñ,ó ð,ò-÷#ð #r   )r   r	   r
   r   )rg   rq   Úwarningsr   Úpasslib.utils.handlersÚutilsÚhandlersr&   Úpasslib.crypto.desr   Úpasslib.utilsr   Úpasslib.utils.binaryr   r   Ú__all__r%   r   r.   r4   r8   ÚTruncateMixinÚHasManyBackendsÚHasSaltÚGenericHandlerr   Ú	HasRoundsr	   r
   r   r   r   r   Ú<module>rË      sÓ   ðÙ /ã 	Ý ç #Ð #Ý 4Ý $ß ,ò€ð 
€òMò'ò>
ò'ô2[Q�× Ñ  "×"4Ñ"4°b·j±jÀ"×BSÑBSô [Qô|
�×#Ñ# R§\¡\°2·:±:¸r×?PÑ?Pô 
ôDF#ˆr�z‰z˜2×,Ñ,ô F#ôRf#ˆb×Ñ §
¡
¨B×,=Ñ,=ö f#r   