ó Ú_e[c @`s ddlmZddlmZddlZddlZddlZddlZddlmZddl m Z m Z m Z m Z mZmZmZmZddd d d d d dddddg ZejdƒZddd„Zd„Zd„Zed„Zd„ZdS(i(tabsolute_import(tdivisionN(t_bcrypti(t __author__t __copyright__t __email__t __license__t __summary__t __title__t__uri__t __version__RRR R RRRRtgensaltthashpwtkdftcheckpws^\$2y\$i t2bcC`s³|d krtdƒ‚n|dks3|dkrBtdƒ‚ntjdƒ}tjjdd ƒ}tjj||t|ƒƒd |d d |j d ƒd tjj |ƒS(Nt2aRs%Supported prefixes are b'2a' or b'2b'iisInvalid roundsischar[]it$s%2.2utascii(RR( t ValueErrortosturandomRtffitnewtlibt encode_base64tlentencodetstring(troundstprefixtsalttoutput((s1/tmp/pip-install-KP2Jbq/bcrypt/bcrypt/__init__.pyR +s  cC`sÞt|tjƒs$t|tjƒr3tdƒ‚nd|krNtdƒ‚n|d }|tjd|ƒ}}tjj ddƒ}tj j |||t |ƒƒ}|dkrÂtd ƒ‚n|d tjj |ƒd S( Ns.Unicode-objects must be encoded before hashingts"password may not contain NUL bytesiHs$2b$schar[]i€is Invalid salti(t isinstancetsixt text_typet TypeErrorRt _normalize_retsubRRRRtbcrypt_hashpassRR(tpasswordRt original_saltthashedtretval((s1/tmp/pip-install-KP2Jbq/bcrypt/bcrypt/__init__.pyR <s$  ! cC`s§t|tjƒs$t|tjƒr3tdƒ‚nd|ksKd|krZtdƒ‚nt||ƒ}t|ƒt|ƒkr…tStj j ||t|ƒƒdkS(Ns/Unicode-objects must be encoded before checkingR!s6password and hashed_password may not contain NUL bytesi( R"R#R$R%RR RtFalseRRttimingsafe_bcmp(R)thashed_passwordtret((s1/tmp/pip-install-KP2Jbq/bcrypt/bcrypt/__init__.pyRbs cC`sFt|tjƒs$t|tjƒr3tdƒ‚nt|ƒdksWt|ƒdkrftdƒ‚n|dks~|dkrtdƒ‚n|dkr¨tdƒ‚n|dkr×| r×tjd j|ƒt ƒnt j j d |ƒ}t j j|t|ƒ|t|ƒ|t|ƒ|ƒ}t|dkƒt j j||ƒS( Ns.Unicode-objects must be encoded before hashingis#password and salt must not be emptyisdesired_key_bytes must be 1-512isrounds must be 1 or morei2srWarning: bcrypt.kdf() called with only {0} round(s). This few is not secure: the parameter is linear, like PBKDF2.s uint8_t[](R"R#R$R%RRtwarningstwarntformatt UserWarningRRRRt bcrypt_pbkdft_bcrypt_asserttbuffer(R)Rtdesired_key_bytesRtignore_few_roundstkeytres((s1/tmp/pip-install-KP2Jbq/bcrypt/bcrypt/__init__.pyR ts$$$   -cC`s|stdƒ‚ndS(Nsbcrypt assertion failed(t SystemError(tok((s1/tmp/pip-install-KP2Jbq/bcrypt/bcrypt/__init__.pyR6”s(t __future__RRRtreR1R#tbcryptRt __about__RRRRRRR R t__all__tcompileR&R R RR-R R6(((s1/tmp/pip-install-KP2Jbq/bcrypt/bcrypt/__init__.pyts     :  &