Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
contego / home / tvault / .virtenv / lib / python2.7 / site-packages / nacl / bindings / crypto_pwhash.pyc
Size: Mime:
ó
ۍEYc@`s%ddlmZmZmZddlZddljZddlm	Z	m
Z
ddlmZe
jƒZ
e
jƒZe
jƒZe
jƒZe
jƒZe
jƒZeZeZeZeZe
ZeZdZdZdZ d	dZ!e!d„Z"d„Z#de!d
„Z$eed„Z%d„Z&dS(i(tabsolute_importtdivisiontprint_functionN(tffitlib(tensureiii?i@i icC`srt|dkddtjƒt|dkddtjƒt||d@dkddtjƒt|dkddtjƒt|t|kdjtƒdtjƒt|dd	|>kdtjƒ|d
|}td
}t|d||kdtjƒd||dd
}t|t|kdtjƒt|tj|kdtjƒt|||kddtjƒdS(NisInvalid block sizetraisingsInvalid parallelization factoris Cost factor must be a power of 2sCost factor must be at least 2sp*r is greater than {0}ii€ii is7Memory limit would be exceeded with the choosen n, r, p(Rtexct
ValueErrort
SCRYPT_PR_MAXtformatt
UINT64_MAXtsystmaxsize(tntrtptmaxmemtBlentitVlen((sP/home/tvault/.virtenv/lib/python2.7/site-packages/nacl/bindings/crypto_pwhash.pyt_check_memory_occupation7s2



	





cC`sò|dkrd}nd}||dkrtd}|d|}x£tddƒD]}d||dkrOPqOqOWnq||d}x/tddƒD]}d||dkr’Pq’q’W|dd|}|d	krÛd	}n||}|||fS(
s/Python implementation of libsodium's pickparamsi€ii iii?ii€iÿÿÿ?(trange(topslimittmemlimitRRtmaxntn_log2tmaxrp((sP/home/tvault/.virtenv/lib/python2.7/site-packages/nacl/bindings/crypto_pwhash.pyt nacl_bindings_pick_scrypt_params_s$		
c	
C`stt|tƒdtƒtt|tƒdtƒtt|tƒdtƒtt|tƒdtƒtt|tƒdtƒt||||ƒtjd|ƒ}tj	|t
|ƒ|t
|ƒ|||||ƒ	}t|dkddtjƒtj
tjd|ƒ|ƒS(s1
    Derive a cryptographic key using the ``passwd`` and ``salt``
    given as input.

    The work factor can be tuned by by picking different
    values for the parameters

    :param bytes passwd:
    :param bytes salt:
    :param bytes salt: *must* be *exactly* :py:const:`.SALTBYTES` long
    :param int dklen:
    :param int opslimit:
    :param int n:
    :param int r: block size,
    :param int p: the parallelism factor
    :param int maxmem: the maximum available memory available for scrypt's
                       operations
    :rtype: bytes
    Rs	uint8_t[]is$Unexpected failure in key derivationschar *(Rt
isinstancetintt	TypeErrortbytesRRtnewRt%crypto_pwhash_scryptsalsa208sha256_lltlenRtRuntimeErrortbuffertcast(	tpasswdtsaltRRRtdklenRtbuftret((sP/home/tvault/.virtenv/lib/python2.7/site-packages/nacl/bindings/crypto_pwhash.pyR"}s&	
cC`s\tjdtƒ}tj||t|ƒ||ƒ}t|dkddtjƒtj	|ƒS(s
    Derive a cryptographic key using the ``passwd`` and ``salt``
    given as input, returning a string representation which includes
    the salt and the tuning parameters.

    The returned string can be directly stored as a password hash.

    See :py:func:`.crypto_pwhash_scryptsalsa208sha256` for a short
    discussion about ``opslimit`` and ``memlimit`` values.

    :param bytes passwd:
    :param int opslimit:
    :param int memlimit:
    :return: serialized key hash, including salt and tuning parameters
    :rtype: bytes
    schar[]is&Unexpected failure in password hashingR(
RR!tSCRYPT_STRBYTESRt&crypto_pwhash_scryptsalsa208sha256_strR#RRR$tstring(R'RRR*R+((sP/home/tvault/.virtenv/lib/python2.7/site-packages/nacl/bindings/crypto_pwhash.pyR-­s		
cC`satt|ƒtdkddtjƒtj||t|ƒƒ}t|dkddtjƒtS(sÐ
    Verifies the ``passwd`` against the ``passwd_hash`` that was generated.
    Returns True or False depending on the success

    :param passwd_hash: bytes
    :param passwd: bytes
    :rtype: boolean
    isInvalid password hashRisWrong password(	RR#R,RRRt-crypto_pwhash_scryptsalsa208sha256_str_verifytInvalidkeyErrortTrue(tpasswd_hashR'R+((sP/home/tvault/.virtenv/lib/python2.7/site-packages/nacl/bindings/crypto_pwhash.pyR/Ís

	
i@iÿÿÿ?llÿÿÿÿi('t
__future__RRRRtnacl.exceptionst
exceptionsRtnacl._sodiumRRRt,crypto_pwhash_scryptsalsa208sha256_saltbytest,crypto_pwhash_scryptsalsa208sha256_SALTBYTESt+crypto_pwhash_scryptsalsa208sha256_strbytest+crypto_pwhash_scryptsalsa208sha256_STRBYTESt7crypto_pwhash_scryptsalsa208sha256_opslimit_interactivet7crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_INTERACTIVEt7crypto_pwhash_scryptsalsa208sha256_memlimit_interactivet7crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_INTERACTIVEt5crypto_pwhash_scryptsalsa208sha256_opslimit_sensitivet5crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_SENSITIVEt5crypto_pwhash_scryptsalsa208sha256_memlimit_sensitivet5crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_SENSITIVEtSCRYPT_OPSLIMIT_INTERACTIVEtSCRYPT_MEMLIMIT_INTERACTIVEtSCRYPT_OPSLIMIT_SENSITIVEtSCRYPT_MEMLIMIT_SENSITIVEtSCRYPT_SALTBYTESR,R	tLOG2_UINT64_MAXRtSCRYPT_MAX_MEMRRR"R-R/(((sP/home/tvault/.virtenv/lib/python2.7/site-packages/nacl/bindings/crypto_pwhash.pyt<module>s6
(	0