zfc@sdZdZeeZeeZeZedZd Zd edZ y.ddl Z e Z eZ ej e jZWnek reZ eZ nXxUeD]MZye eee>> 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_hmaccCsIy(ttd|}|dt|SWnttfk rDnXdS(Ntopenssl_tusedforsecurity(tgetattrt_hashlibtFalsetAttributeErrort ValueError(tnametf((s/usr/lib64/python2.7/hashlib.pyt__get_openssl_constructorYs  tcCs2ytj|||SWntk r-nXdS(snew(name, string='', usedforsecurity=True) - Return a new hashing object using the named algorithm; optionally initialized with a string. Override 'usedforsecurity' to False when using for non-security purposes in a FIPS environment N(RRR(RtstringR ((s/usr/lib64/python2.7/hashlib.pyt __hash_newjs iNscode for hash %s was not found.(R ccs|]}t|dAVqdS(i\N(tchr(t.0tx((s/usr/lib64/python2.7/hashlib.pys siccs|]}t|dAVqdS(i6N(R(RR((s/usr/lib64/python2.7/hashlib.pys scCsCt|tst|nt|ttfsHtt|}nt|ttfsrtt|}nt|}t|}t|dd}t||krt||j }n|d|t|}|j |j t |j |j t ||d}|dkr4t|n|d krL|j}n|dkrgt|ndt|jd} d} d} xt| |kr:||tjd | } ttj| d } x@t|dD].}|| } | ttj| d N} qW| d7} | tj| | 7} qW| | S( sPassword 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|jS(N(tcopytupdatetdigest(tmsgtinnertouterticpytocpy((s/usr/lib64/python2.7/hashlib.pytprfs    is%%0%ixiRs>IiN(t isinstancetstrt TypeErrortbytest bytearraytbufferRR tlenRRt translatet _trans_36t _trans_5CRtNonet digest_sizetstructtpacktinttbinasciithexlifytxranget unhexlify(t hash_nametpasswordtsaltt iterationstdklenR R!t blocksizeR$thex_format_stringtdkeytlooptprevtrkeyti((s/usr/lib64/python2.7/hashlib.pyR sB         (RRRRRR(RRRR R (t__doc__t__always_supportedtsetRRR t__all__RtTrueRRRt __get_hashtuniontopenssl_md_meth_namest ImportErrort__py_newt__get_builtin_constructort __func_nametglobalsRtloggingt exceptionR R4R1tjointrangeR.R-R/(((s/usr/lib64/python2.7/hashlib.pytIsD            9