+
    ¢THi•.  ã            
       ó
  € R t ^ RIHu Ht ^ RIHt ^ RIH	t	 ^ RI
HtHtHt ^ RIHt ^ RIHt R.tRtR	tR
t ! R R]P,                  ]P.                  ]P0                  ]P2                  ]P4                  ]P6                  4      tR# )zscrypt password hashN)Úscrypt)Úto_bytes)Úb64s_decodeÚb64s_encodeÚh64)Úbascii_to_str)Úclasspropertyr   z$scrypt$z$7$Ú$c                   óL  a a€ ] tR t^t oRtR tRt^ t]t	]]
3t^tRt^t^t^tRt^t^t]RV 3R ll4       t]R 4       t]R 4       t]R 4       t]R 4       tR	 tRV 3R
 llt]RR l4       tV 3R lt]R 4       t]R 4       t ]RR l4       t!]RR l4       t"R t#V 3R lt$Rt%Vt&V ;t'# )r   a×  This class implements an SCrypt-based password [#scrypt-home]_ hash, and follows the :ref:`password-hash-api`.

It supports a variable-length salt, a variable number of rounds,
as well as some custom tuning parameters unique to scrypt (see below).

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

:type salt: str
:param salt:
    Optional salt string.
    If specified, the length must be between 0-1024 bytes.
    If not specified, one will be auto-generated (this is recommended).

:type salt_size: int
:param salt_size:
    Optional number of bytes to use when autogenerating new salts.
    Defaults to 16 bytes, but can be any value between 0 and 1024.

:type rounds: int
:param rounds:
    Optional number of rounds to use.
    Defaults to 16, but must be within ``range(1,32)``.

    .. warning::

        Unlike many hash algorithms, increasing the rounds value
        will increase both the time *and memory* required to hash a password.

:type block_size: int
:param block_size:
    Optional block size to pass to scrypt hash function (the ``r`` parameter).
    Useful for tuning scrypt to optimal performance for your CPU architecture.
    Defaults to 8.

:type parallelism: int
:param parallelism:
    Optional parallelism to pass to scrypt hash function (the ``p`` parameter).
    Defaults to 1.

: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.

.. note::

    The underlying scrypt hash function has a number of limitations
    on it's parameter values, which forbids certain combinations of settings.
    The requirements are:

    * ``linear_rounds = 2**<some positive integer>``
    * ``linear_rounds < 2**(16 * block_size)``
    * ``block_size * parallelism <= 2**30-1``

.. todo::

    This class currently does not support configuring default values
    for ``block_size`` or ``parallelism`` via a :class:`~passlib.context.CryptContext`
    configuration.
i   Úlog2c                ó˜  <€ \         SV `  ! R/ VB pVeH   \        V\        4      '       d   \	        V4      pVP                  WP                  R4      R7      Vn         \        P                  ! ^V P                  ,          V P                  V P                  4       V#   \         d"   p\        R\        T4      ,           4      R hR p?ii ; i)NÚrelaxed)r   z&scrypt: invalid settings combination: © )ÚsuperÚusingÚ
isinstanceÚstrÚintÚ_norm_block_sizeÚgetÚ
block_sizeÚ_scryptÚvalidateÚdefault_roundsÚparallelismÚ
ValueError)Úclsr   ÚkwdsÚsubclsÚerrÚ	__class__s   &&,  €Ú9/usr/lib/python3/dist-packages/passlib/handlers/scrypt.pyr   Úscrypt.using‰   s³   ø€ ä‘’Ñ& Ñ&ˆØÒ!Ü˜*¤c×*Ò*Ü  ›_�
Ø &× 7Ñ 7Ø§H¡H¨YÓ$7ð !8ó !ˆFÔð
	Ü×Ò˜Q #×"4Ñ"4Õ4°c·n±nÀcÇoÁoÔVð ˆøô ô 	ÜØ8¼3¸s»8ÕCóàðûð	ús   Á=B ÂC	Â(CÃC	c                ó0   € V ! R/ V P                  V4      B # )Nr   )Úparse)r   Úhashs   &&r!   Úfrom_stringÚscrypt.from_string�   s   € áÑ%�S—Y‘Y˜t“_Ñ%Ð%ó    c                óÎ   € V P                  V4      w  r#\        V R VP                  \        4       R2R4      pV'       d	   V! V4      # \        P
                  P                  V 4      h)Ú_parse_Ú_stringN)Ú_parse_identÚgetattrÚstripÚ_UDOLLARÚuhÚexcÚInvalidHashError)r   r%   ÚidentÚsuffixÚfuncs   &&   r!   r$   Úscrypt.parse¡   sW   € à×(Ñ(¨Ó.‰ˆÜ�s˜g e§k¡k´(Ó&;Ð%<¸GÐDÀdÓKˆßÙ˜“<ÐÜ�f‰f×%Ñ% cÓ*Ð*r(   c                óê  € VP                  R 4      p\        V4      ^8X  d   Vw  r4pM7\        V4      ^8X  d   Vw  r4RpM \        P                  P	                  V R4      hVP                  R4      p\        V4      ^8X  dR   Vw  rgpVP                  R4      '       g   Q hVP                  R4      '       g   Q hVP                  R4      '       g   Q hM \        P                  P	                  V R4      h\        \        \        VR,          4      \        VR	,          4      \        VR	,          4      \        VP                  R
4      4      V'       d    \        VP                  R
4      4      R7      # RR7      # )r	   Nzmalformed hashÚ,zln=zr=zp=zmalformed settings field:é   NN:é   NNÚascii©r3   Úroundsr   r   ÚsaltÚchecksum)ÚsplitÚlenr0   r1   ÚMalformedHashErrorÚ
startswithÚdictÚIDENT_SCRYPTr   r   Úencode)	r   r4   ÚpartsÚparamsr>   ÚdigestÚnstrÚbstrÚpstrs	   &&       r!   Ú_parse_scrypt_stringÚscrypt._parse_scrypt_string´   s8  € ð —‘˜SÓ!ˆÜˆu‹:˜Œ?Ø#(Ñ ˆF™&Ü�‹Z˜1Œ_Ø ‰LˆFØ‰Fä—&‘&×+Ñ+¨CÐ1AÓBÐBð —‘˜SÓ!ˆÜˆu‹:˜Œ?Ø$ÑˆD˜Ø—?‘? 5×)Ò)Ð)Ð)Ø—?‘? 4×(Ò(Ð(Ð(Ø—?‘? 4×(Ò(Ð(Ñ(ä—&‘&×+Ñ+¨CÐ1KÓLÐLäÜÜ�t˜B•x“=Ü˜4 �8“}Ü˜D �H›Ü˜TŸ[™[¨Ó1Ó2ß<B”[ §¡¨wÓ!7Ó8ô
ð 	
ð IMô
ð 	
r(   c           
     óN  € VP                  R 4      P                  R4      p\        V4      ^8X  d   Vw  r4M1\        V4      ^8X  d   Vw  pRpM\        P                  P
                  h\        V4      ^8  d!   \        P                  P                  V R4      h\        \        \        P                  ! VR,          4      \        P                  ! VR,          4      \        P                  ! VR,          4      VR,          V'       d   \        P                  ! V4      R7      # RR7      # )	r;   ó   $Nzparams field too short:Né   N:rQ   é   N:rR   é   N:rS   NNr<   )rF   r@   rA   r0   r1   rB   rD   ÚIDENT_7r   Údecode_int6Údecode_int30Údecode_bytes)r   r4   rG   rH   rI   s   &&   r!   Ú_parse_7_stringÚscrypt._parse_7_stringâ   sé   € ð —‘˜gÓ&×,Ñ,¨TÓ2ˆÜˆu‹:˜Œ?Ø"‰NˆF�FÜ�‹Z˜1Œ_Ø‰IˆVØ‰Fä—&‘&×+Ñ+Ð+ô ˆv‹;˜ÔÜ—&‘&×+Ñ+¨CÐ1IÓJÐJÜÜÜ—?’? 6¨"¥:Ó.Ü×'Ò'¨¨s­Ó4Ü×(Ò(¨°­Ó6Ø˜•ß17”S×%Ò% fÓ-ô
ð 	
ð >Bô
ð 	
r(   c                óÊ  € V P                   pV\        8X  de   R V P                  V P                  V P                  \        \        V P                  4      4      \        \        V P                  4      4      3,          # V\        8X  g   Q hV P                  p VP                  R4       \        RP                  R\        P                  ! T P                  4      \        P                   ! T P                  4      \        P                   ! T P                  4      T P                  R\        P"                  ! T P                  4      .4      4      #   \         d    \        R4      Rhi ; i)z$scrypt$ln=%d,r=%d,p=%d$%s$%sr;   z.scrypt $7$ hashes dont support non-ascii saltsNr(   s   $7$rP   )r3   rE   r=   r   r   r   r   r>   r?   rT   ÚdecodeÚUnicodeDecodeErrorÚNotImplementedErrorÚjoinr   Úencode_int6Úencode_int30Úencode_bytes)Úselfr3   r>   s   &  r!   Ú	to_stringÚscrypt.to_stringý   s!  € Ø—
‘
ˆØ”LÔ Ø2Ø—‘Ø—‘Ø× Ñ Üœk¨$¯)©)Ó4Ó5Üœk¨$¯-©-Ó8Ó9ð6õ ð ð œÔÐÐØ�y‰yˆð	Ø�K‰K˜Ô ô
 Ø�H‰HàÜ—O’O D§K¡KÓ0Ü×$Ò$ T§_¡_Ó5Ü×$Ò$ T×%5Ñ%5Ó6Ø—I‘IØÜ×$Ò$ T§]¡]Ó3ðó
ó
ð 	
øô	 "ô 	Ü%Ø@óàðð	ús   ÂE
 Å
E"c                óÊ   <€ \         SV `  ! R/ VB  Vf8   \        P                  ! W P                  V P
                  RR7      '       g   Q hR # V P                  V4      V n        R # )Nr   ©Úparamr   )r   Ú__init__r0   Úvalidate_default_valuer   r   )rb   r   r   r    s   &&,€r!   rh   Úscrypt.__init__  s]   ø€ Ü‰ÒÑ ˜4Ò ð ÒÜ×,Ò,Ø—o‘o t×'<Ñ'<ÀL÷ó ð ò ð #×3Ñ3°JÓ?ˆDŽOr(   c                ó6   € \         P                  ! W^RVR7      # )rQ   r   )Úminrg   r   )r0   Únorm_integer)r   r   r   s   &&&r!   r   Úscrypt._norm_block_size+  s   € ä�ŠØ ¨,Àô
ð 	
r(   c                ód   <€ \         SV `  4       pV P                  \        8X  d   \	        V4      pV# ©N)r   Ú_generate_saltr3   rT   r   )rb   r>   r    s   & €r!   rq   Úscrypt._generate_salt1  s-   ø€ Ü‰wÑ%Ó'ˆØ�:‰:œÔ ô ˜tÓ$ˆDØˆr(   c                ó"   € \         P                  # rp   )r   Úbackend_values©r   s   &r!   ÚbackendsÚscrypt.backends?  s   € ä×%Ñ%Ð%r(   c                ó"   € \         P                  # rp   )r   Úbackendru   s   &r!   Úget_backendÚscrypt.get_backendC  s   € ä�‰Ðr(   c                óz   €  V P                  VR R7       R #   \        P                  P                   d     R# i ; i)T©ÚdryrunF)Úset_backendr0   r1   ÚMissingBackendError)r   Únames   &&r!   Úhas_backendÚscrypt.has_backendG  s6   € ð	Ø�O‰O˜D¨ˆOÔ.ÙøÜ�v‰v×)Ñ)ô 	Úð	ús   ‚ —:¹:c                ó4   € \         P                  ! WR 7       R# )r}   N)r   Ú_set_backend)r   r�   r~   s   &&&r!   r   Úscrypt.set_backendO  s   € ä×Ò˜T×1r(   c           	     óÆ   € \        VR R7      p\        P                  ! VV P                  ^V P                  ,          V P
                  V P                  V P                  R7      # )Úsecretrf   )ÚnÚrÚpÚkeylen)r   r   r   r>   r=   r   r   Úchecksum_size)rb   rˆ   s   &&r!   Ú_calc_checksumÚscrypt._calc_checksumS  sN   € Ü˜&¨Ô1ˆÜ�~Š~ØØ�I‰IØ�D—K‘KÕØ�o‰oØ×ÑØ×%Ñ%ô
ð 	
r(   c                óp   <€ V P                   \        V 4      P                   8w  d   R# \        SV `  ! R/ VB # )zB
mark hash as needing update if rounds is outside desired bounds.
Tr   )r   Útyper   Ú_calc_needs_update)rb   r   r    s   &,€r!   r’   Úscrypt._calc_needs_update^  s1   ø€ ð
 �?‰?œd 4›j×3Ñ3Ô3ÙÜ‰wÒ)Ñ1¨DÑ1Ð1r(   )r   )r3   r>   Ú	salt_sizer=   r   r   rp   )F)Úany)r•   F)(Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r�   Úsetting_kwdsr�   rE   Údefault_identrT   Úident_valuesÚdefault_salt_sizeÚmax_salt_sizer   Ú
min_roundsÚ
max_roundsÚrounds_costr   r   Úclassmethodr   r&   r$   rM   rX   rc   rh   r   rq   r   rv   rz   r‚   r   rŽ   r’   Ú__static_attributes__Ú__classdictcell__Ú__classcell__)r    Ú__classdict__s   @@r!   r   r      sG  ù‡ € ñ>ðF €DØX€Lð €Mð
 !€MØ  'Ð*€Lð
 ÐØ€Mð €NØ€JØ€JØ€Kð
 €Kð €Jàöó ðð& ñ&ó ð&ð ñ+ó ð+ð$ ñ
ó ð
ðZ ñ
ó ð
ò4
÷@	@ð ó
ó ð
õ
ð ñ&ó ð&ð ñó ðð óó ðð ó2ó ð2ò	
÷2õ 2r(   )rš   Úpasslib.utils.handlersÚutilsÚhandlersr0   Úpasslib.cryptor   r   Úpasslib.utilsr   Úpasslib.utils.binaryr   r   r   Úpasslib.utils.compatr   Úpasslib.utils.decorr   Ú__all__rE   rT   r/   ÚParallelismMixinÚ	HasRoundsÚ
HasRawSaltÚHasRawChecksumÚHasManyIdentsÚGenericHandlerr   r(   r!   Ú<module>r·      s{   ðÙ ç #Ð #Ý ,Ý "ß >Ñ >Ý .Ý -ð ð€ð
 €Ø
€à€ôP2Ø×ÑØ‡L�LØ‡M�MØ×ÑØ×ÑØ×ÑöP2r(   