/opt/alt/python27/lib64/python2.7/site-packages/Crypto/Protocol
NameSizeModeActions
AllOrNothing.py118970644editdlrm
AllOrNothing.pyc81840644editdlrm
AllOrNothing.pyo81370644editdlrm
Chaffing.py102450644editdlrm
Chaffing.pyc86530644editdlrm
Chaffing.pyo86000644editdlrm
KDF.py50710644editdlrm
KDF.pyc47170644editdlrm
KDF.pyo47170644editdlrm
__init__.py15730644editdlrm
__init__.pyc7960644editdlrm
__init__.pyo7960644editdlrm
Edit: /opt/alt/python27/lib64/python2.7/site-packages/Crypto/Protocol/KDF.pyo (4717B)
Ñò Bd\Rc @sydZdZddkZddkZddkTddklZlZddk l Z ddd„Z d ddd „Z dS( s¾This file contains a collection of standard key derivation functions. A key derivation function derives one or more secondary secret keys from one primary secret (a master key or a pass phrase). This is typically done to insulate the secondary keys from each other, to avoid that leakage of a secondary key compromises the security of the master key, or to thwart attacks on pass phrases (e.g. via rainbow tables). :undocumented: __revision__ s$Id$iÿÿÿÿN(t*(tSHAtHMAC(tstrxoriècCs»|p t}nt|ƒ}|i||ƒ}|i}||jotd|ƒ‚nt|ƒdjotdƒ‚nx-t|dƒD]}|i|iƒƒ}qŽW|iƒ| S(sÙDerive one key from a password (or passphrase). This function performs key derivation according an old version of the PKCS#5 standard (v1.5). This algorithm is called ``PBKDF1``. Even though it is still described in the latest version of the PKCS#5 standard (version 2, or RFC2898), newer applications should use the more secure and versatile `PBKDF2` instead. :Parameters: password : string The secret password or pass phrase to generate the key from. salt : byte string An 8 byte string to use for better protection from dictionary attacks. This value does not need to be kept secret, but it should be randomly chosen for each derivation. dkLen : integer The length of the desired key. Default is 16 bytes, suitable for instance for `Crypto.Cipher.AES`. count : integer The number of iterations to carry out. It's recommended to use at least 1000. hashAlgo : module The hash algorithm to use, as a module or an object from the `Crypto.Hash` package. The digest length must be no shorter than ``dkLen``. The default algorithm is `SHA1`. :Return: A byte string of length `dkLen` that can be used as key. s:Selected hash algorithm has a too short digest (%d bytes).isSalt is not 8 bytes long.i(tSHA1ttobytestnewt digest_sizet ValueErrortlentxrangetdigest(tpasswordtsalttdkLentcountthashAlgotpHashR ti((sF/opt/alt/python27/lib64/python2.7/site-packages/Crypto/Protocol/KDF.pytPBKDF1-s    ic CsÏt|ƒ}|djo d„}ntdƒ}d}xŒt|ƒ|jox|||tid|ƒƒ}}x:t|dƒD](} |||ƒ}} t|| ƒ}q‚W||7}|d}q;W|| S(s‡Derive one or more keys from a password (or passphrase). This performs key derivation according to the PKCS#5 standard (v2.0), by means of the ``PBKDF2`` algorithm. :Parameters: password : string The secret password or pass phrase to generate the key from. salt : string A string to use for better protection from dictionary attacks. This value does not need to be kept secret, but it should be randomly chosen for each derivation. It is recommended to be at least 8 bytes long. dkLen : integer The cumulative length of the desired keys. Default is 16 bytes, suitable for instance for `Crypto.Cipher.AES`. count : integer The number of iterations to carry out. It's recommended to use at least 1000. prf : callable A pseudorandom function. It must be a function that returns a pseudorandom string from two parameters: a secret and a salt. If not specified, HMAC-SHA1 is used. :Return: A byte string of length `dkLen` that can be used as key material. If you wanted multiple keys, just break up this string into segments of the desired length. cSsti||tƒiƒS((RRRR (tpts((sF/opt/alt/python27/lib64/python2.7/site-packages/Crypto/Protocol/KDF.pytpstis>IN(RtNonetbR tstructtpackR R( R R RRtprftkeyRtUt previousUtjtt((sF/opt/alt/python27/lib64/python2.7/site-packages/Crypto/Protocol/KDF.pytPBKDF2Vs    # (t__doc__t __revision__tmathRtCrypto.Util.py3compatt Crypto.HashRRRtCrypto.Util.strxorRRRR"(((sF/opt/alt/python27/lib64/python2.7/site-packages/Crypto/Protocol/KDF.pyt"s   )