ó fWG`c@s¤dZdZeeƒZeeƒZeZedZd „Zd „Zdd„Z dd„Z y.ddl Z e Z eZ eje jƒZWnek r«e Z eZ nXxUeD]MZye eƒeƒe>> import hashlib >>> m = hashlib.md5() >>> m.update("Nobody inspects") >>> m.update(" the spammish repetition") >>> m.digest() '\xbbd\x9c\x83\xdd\x1e\xa5\xc9\xd9\xde\xc9\xa1\x8d\xf0\xff\xe9' More condensed: >>> hashlib.sha224("Nobody inspects the spammish repetition").hexdigest() 'a4337bc45a8fc544c03f52dc550cd6e1e87021bc896588bd79e901e2' tmd5tsha1tsha224tsha256tsha384tsha512tnewtalgorithms_guaranteedtalgorithms_availablet algorithmst pbkdf2_hmaccCsyØ|dkr"ddl}|jS|dkrAddl}|jS|dkrŒddl}|d }|d krv|jS|d kr×|jSnK|dkr×ddl}|d }|dkrÁ|jS|dkr×|jSnWnt k rënXt d|ƒ‚dS(NtSHA1RiÿÿÿÿtMD5RtSHA256RtSHA224Rit256t224tSHA512RtSHA384Rt512t384sunsupported hash type (R R(R R(R RRR(RRRR( t_shaRt_md5t_sha256RRt_sha512RRt ImportErrort ValueError(tnameRRRtbsR((s/usr/lib/python2.7/hashlib.pyt__get_builtin_constructorHs0                cCsGy"ttd|ƒ}|ƒ|SWnttfk rBt|ƒSXdS(Ntopenssl_(tgetattrt_hashlibtAttributeErrorRR(Rtf((s/usr/lib/python2.7/hashlib.pyt__get_openssl_constructords tcCst|ƒ|ƒS(s|new(name, string='') - Return a new hashing object using the named algorithm; optionally initialized with a string. (R(Rtstring((s/usr/lib/python2.7/hashlib.pyt__py_newpscCs9ytj||ƒSWntk r4t|ƒ|ƒSXdS(s|new(name, string='') - Return a new hashing object using the named algorithm; optionally initialized with a string. N(R RRR(RR%((s/usr/lib/python2.7/hashlib.pyt __hash_newws iÿÿÿÿNscode for hash %s was not found.(R ccs|]}t|dAƒVqdS(i\N(tchr(t.0tx((s/usr/lib/python2.7/hashlib.pys  siccs|]}t|dAƒVqdS(i6N(R((R)R*((s/usr/lib/python2.7/hashlib.pys ¡scCsCt|tƒst|ƒ‚nt|ttfƒsHtt|ƒƒ}nt|ttfƒsrtt|ƒƒ}nt|ƒ}t|ƒ}t|ddƒ}t|ƒ|krÆt||ƒj ƒ}n|d|t|ƒ}|j |j t ƒƒ|j |j t ƒƒ||d„}|dkr4t|ƒ‚n|d krL|j}n|dkrgt|ƒ‚ndt|ƒjd} d} d} x®t| ƒ|kr:||tjd | ƒƒ} ttj| ƒd ƒ} x@t|dƒD].}|| ƒ} | ttj| ƒd ƒN} qäW| d7} | tj| | ƒ7} qW| | S( sóPassword based key derivation function 2 (PKCS #5 v2.0) This Python implementations based on the hmac module about as fast as OpenSSL's PKCS5_PBKDF2_HMAC for short passwords and much faster for long passwords. t block_sizei@scSsB|jƒ}|jƒ}|j|ƒ|j|jƒƒ|jƒS(N(tcopytupdatetdigest(tmsgtinnertouterticpytocpy((s/usr/lib/python2.7/hashlib.pytprf¼s    is%%0%ixiR$s>IiN(t isinstancetstrt TypeErrortbytest bytearraytbufferRRtlenR.R-t translatet _trans_36t _trans_5CRtNonet digest_sizetstructtpacktinttbinasciithexlifytxranget unhexlify(t hash_nametpasswordtsaltt iterationstdklenR0R1t blocksizeR4thex_format_stringtdkeytlooptprevtrkeyti((s/usr/lib/python2.7/hashlib.pyR £sB         (RRRRRR(RRRR R (t__doc__t__always_supportedtsetRRR t__all__RR#R&R'R Rt __get_hashtuniontopenssl_md_meth_namesRt __func_nametglobalsRtloggingt exceptionR RDRAtjointrangeR>R=R?(((s/usr/lib/python2.7/hashlib.pyt8sH              9