ó {G_Tc@szdZdZeZedZd „Zd „Zd d „Zd d„ZyddlZeZ eZ Wne k reZ eZ nXxUeD]MZ ye 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' tmd5tsha1tsha224tsha256tsha384tsha512tnewt 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 ssha256R ssha224(Rssha512Rssha384( t_shaRt_md5t_sha256RRt_sha512RRt ImportErrort ValueError(tnameRRRtbsR((s#/usr/local/lib/python2.7/hashlib.pyt__get_builtin_constructorBs0                cCsGy"ttd|ƒ}|ƒ|SWnttfk rBt|ƒSXdS(Ntopenssl_(tgetattrt_hashlibtAttributeErrorRR(Rtf((s#/usr/local/lib/python2.7/hashlib.pyt__get_openssl_constructor^s tcCst|ƒ|ƒS(s|new(name, string='') - Return a new hashing object using the named algorithm; optionally initialized with a string. (R(Rtstring((s#/usr/local/lib/python2.7/hashlib.pyt__py_newjscCs9ytj||ƒSWntk r4t|ƒ|ƒSXdS(s|new(name, string='') - Return a new hashing object using the named algorithm; optionally initialized with a string. N(RRRR(RR#((s#/usr/local/lib/python2.7/hashlib.pyt __hash_newqs iÿÿÿÿNscode for hash %s was not found.(Rccs|]}t|dAƒVqdS(i\N(tchr(t.0tx((s#/usr/local/lib/python2.7/hashlib.pys ˜siccs|]}t|dAƒVqdS(i6N(R&(R'R(((s#/usr/local/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@tcSsB|jƒ}|jƒ}|j|ƒ|j|jƒƒ|jƒS(N(tcopytupdatetdigest(tmsgtinnertouterticpytocpy((s#/usr/local/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 iterationstdklenR/R0t blocksizeR3thex_format_stringtdkeytlooptprevtrkeyti((s#/usr/local/lib/python2.7/hashlib.pyR›sB         (smd5ssha1ssha224ssha256ssha384ssha512(snews algorithmss pbkdf2_hmac(t__doc__t__always_supportedRt__all__RR!R$R%RRt __get_hashRt __func_nametglobalsRtloggingt exceptionRRCR@tjointrangeR=R<R>(((s#/usr/local/lib/python2.7/hashlib.pyt7s<              9