+
    i"                     Z    R t ^ RIt^ RIt^ RIHt ^ RIHt ^ RIHt R.t	 ! R R]
4      tR# )z<passlib.utils.scrypt._builtin -- scrypt() kdf in pure-pythonN)izip)pbkdf2_hmac)salsa20ScryptEnginec                   v   a  ] tR t^t o Rt^ t^ t^ t^ t^ t	^ t
^ tRtRt]R 4       tR tR tR tR tR tR	tV tR# )
r   z
helper class used to run scrypt kdf, see scrypt() for frontend

.. warning::
    this class does NO validation of the input ranges or types.

    it's not intended to be used directly,
    but only as a backend for :func:`passlib.utils.scrypt.scrypt()`.
Nc                4    V ! W4V4      P                  WV4      # )z-create engine & run scrypt() hash calculation)run)clssecretsaltnrpkeylens   &&&&&&&\/var/www/html/photoedit/myenv/lib/python3.14/site-packages/passlib/crypto/scrypt/_builtin.pyexecuteScryptEngine.execute2   s     1|f55    c                D  aa Wn         W n        W0n        V^,          V n        V P                  V,          V n        V^,          ;V n        pV^,          V n        \        P                  ! R4      ^8X  g   Q h\        P                  ! R\        V4      ,           R,           4      V n        V^8X  d   V P                  V n        VR8:  d   \        P                  ! R4      pM<VR8:  g   Q h\        P                  ! R4      o\        P                  ! R4      oVV3R lpWPn        R# )	   I<l    l    c                 <   < S! V 4      S! V 4      ^ ,          ,          # )     )Xig1ig2s   &r   
integerify)ScryptEngine.__init__.<locals>.integerifyU   s    1vQ,,r   Ni)r   r   r   
smix_bytesiv_bytesbmix_lenbmix_half_lenstructcalcsizeStructstrbmix_struct_bmix_1bmixoperator
itemgetterr   )selfr   r   r   r#   r   r   r   s   &&&&  @@r   __init__ScryptEngine.__init__:   s    q&!+#$6)!Vs#q(((!==s8})<s)BC 6DI 
?!,,S1J****%%c*C%%c*C-$r   c                  aaa V P                   p\        RW^VR7      oV P                  oV P                  ^8X  d
   S! S4      pM4V P                  oRP                  VVV3R l\        ^ VS4       4       4      p\        RW^VR7      # )z
run scrypt kdf for specified secret, salt, and keylen

.. note::

    * time cost is ``O(n * r * p)``
    * mem cost is ``O(n * r)``
sha256)roundsr   r   c              3   F   <"   T F  pS! SWS,            4      x  K  	  R # 5iNr   ).0offsetinputsmixr!   s   & r   	<genexpr>#ScryptEngine.run.<locals>.<genexpr>r   s*      <F U6"3455<s   !)r"   r   r9   r   r!   joinrange)	r.   r
   r   r   r"   outputr8   r9   r!   s	   &&&&  @@@r   r   ScryptEngine.run\   s     ==Hf1XN yy66Q;%[F JXX #Ax< F 8VAfMMr   c           	       aaa V P                   oV P                  pV P                  pV P                  o\	        VP                  V4      4      oVVV3R lp\	        V! 4       4      pVP                  pS^,
          p^ pVS8  dp   V! S4      V,          p	\        ;QJ d$    . R \        SV! V	4      4       4       F  NK  	  5M! R \        SV! V	4      4       4       4      p
S! V
S4       V^,          pKv  VP                  ! S!  # )a3  run SCrypt smix function on a single input block

:arg input:
    byte string containing input data.
    interpreted as 32*r little endian 4 byte integers.

:returns:
    byte string containing output data
    derived by mixing input using n & r parameters.

.. note:: time & mem cost are both ``O(n * r)``
c               3   h   <"   ^ p V S8  d$   \        S4      pVx  S! VS4       V ^,          p K*  R# 5i)    N)tuple)ilastr+   bufferr   s     r   vgenScryptEngine.smix.<locals>.vgen   s8     Aa%V}
T6"Q	 s   /2c              3   6   "   T F  w  rW,          x  K  	  R # 5ir5   r   r6   abs   &  r   r:   $ScryptEngine.smix.<locals>.<genexpr>   s     I-HTQ155-H   )
r+   r)   r   r   listunpack__getitem__rC   r   pack)r.   r8   r)   r   rG   V
get_v_elemn_maskrD   jresultr+   rF   r   s   &&         @@@r   r9   ScryptEngine.smix}   s     yy&&__
FF k((/0	 L ]]
Q!e6"V+AUIT&*Q--HIUUIT&*Q--HIIF FA ((r   c                    V P                   pVRR p\        V4      p^ pWc8  dY   V^,           p\        R \        WE4       4       4      ;W&V% p\        R \        WE4       4       4      ;W#V,           W7,           % pTpK^  R# )aj  
block mixing function used by smix()
uses salsa20/8 core to mix block contents.

:arg source:
    source to read from.
    should be list of 32*r 4-byte integers
    (2*r salsa20 blocks).

:arg target:
    target to write to.
    should be list with same size as source.
    the existing value of this buffer is ignored.

.. warning::

    this operates *in place* on target,
    so source & target should NOT be same list.

.. note::

    * time cost is ``O(r)`` -- loops 16*r times, salsa20() has ``O(1)`` cost.

    * memory cost is ``O(1)`` -- salsa20() uses 16 x uint4,
      all other operations done in-place.
Nc              3   6   "   T F  w  rW,          x  K  	  R # 5ir5   r   rJ   s   &  r   r:   $ScryptEngine.bmix.<locals>.<genexpr>   s     (L;K41;KrN   c              3   6   "   T F  w  rW,          x  K  	  R # 5ir5   r   rJ   s   &  r   r:   r[      s     2VEUTQ155EUrN   r    )r$   iterr   r   )r.   sourcetargethalftmpsiterrV   jns   &&&     r   r+   ScryptEngine.bmix   s    < !!STlVh2B!((L4;K(L!LLFRL3+22VT#EU2V+VVF6$'"SA	 r   c           	         VR,          p\        R \        V\        V4      4       4       4      ;VR&   p\        R \        WC4       4       4      VR&   R# )z0special bmix() method optimized for ``r=1`` case:   NNc              3   6   "   T F  w  rW,          x  K  	  R # 5ir5   r   rJ   s   &  r   r:   'ScryptEngine._bmix_1.<locals>.<genexpr>   s     #L6KdaAEE6KrN   :Nrf   Nc              3   6   "   T F  w  rW,          x  K  	  R # 5ir5   r   rJ   s   &  r   r:   rh      s     =aeerN   N)r   r   r]   )r.   r^   r_   Bra   s   &&&  r   r*   ScryptEngine._bmix_1   sG    3K##Ld1d6l6K#LLLsc=S==sr   )
r+   r$   r#   r)   r   r"   r   r   r   r!   )__name__
__module____qualname____firstlineno____doc__r   r   r   r!   r"   r#   r$   r)   r   classmethodr   r/   r   r9   r+   r*   __static_attributes____classdictcell__)__classdict__s   @r   r   r      sr      	
A	A	A JHHMKJ
 6 6%DNB>)F&P> >r   )rp   r,   r%   passlib.utils.compatr   passlib.crypto.digestr   passlib.crypto.scrypt._salsar   __all__objectr   r   r   r   <module>rz      s3    B
   % - 0 
X>6 X>r   