î j fz&ã@sàdZd!ZeeƒZeeƒZed"Zd d lZd d„ZiZdd„Z dd„Z dddd„Z dddd„Z y.d d l Z e Ze Zeje jƒZWnek rÖe Ze ZYnXyd dl mZWn_ek rLedd„edƒDƒƒZedd„edƒDƒƒZd dd „ZYnXxweD]oZy8eeƒZdekr„eeƒZneeƒe>> import hashlib >>> m = hashlib.md5() >>> m.update(b"Nobody inspects") >>> m.update(b" the spammish repetition") >>> m.digest() b'\xbbd\x9c\x83\xdd\x1e\xa5\xc9\xd9\xde\xc9\xa1\x8d\xf0\xff\xe9' More condensed: >>> hashlib.sha224(b"Nobody inspects the spammish repetition").hexdigest() 'a4337bc45a8fc544c03f52dc550cd6e1e87021bc896588bd79e901e2' Úmd5Úsha1Úsha224Úsha256Úsha384Úsha512ÚnewÚalgorithms_guaranteedÚalgorithms_availableÚ pbkdf2_hmacéNcs%tjˆƒ‡fdd†ƒ}|S)z¨Used for sha3_* functions. Until OpenSSL implements them, we want to use them from Python _sha3 module, but we want them to accept usedforsecurity argument too.cs)d|kr|jdƒnˆ||ŽS)NÚusedforsecurity)Úpop)ÚargsÚkwargs)Úfunc©ú,/opt/alt/python34/lib64/python3.4/hashlib.pyÚinnerQs z'__ignore_usedforsecurity..inner)Ú functoolsÚwraps)rrr)rrÚ__ignore_usedforsecurityLs!rc Cs[t}|j|ƒ}|dk r%|Syî|dkrXddl}|j|d<|d¯sr5éccs|]}|dAVqdS)é6Nr)r3r4rrrr5°scCs1t|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 ƒƒ||dd„}|dkr7t|ƒ‚n|dkrO|j}n|dkrjt|ƒ‚nd} d} tj} x¡t| ƒ|kr"||| jd d ƒƒ} tj| d ƒ} x7t|dƒD]%}|| ƒ} | | | d ƒN} qÓW| d7} | | j|jd ƒ7} q‚W| d|…S) zó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. Z block_sizeé@scSsB|jƒ}|jƒ}|j|ƒ|j|jƒƒ|jƒS)N)ÚcopyÚupdateÚdigest)ÚmsgrÚouterZicpyZocpyrrrÚprfËs    zpbkdf2_hmac..prféNr.éZbig)Ú isinstanceÚstrÚ TypeErrorÚbytesÚ bytearrayÚ memoryviewrr)Úlenr;r:Ú translateÚ _trans_36Ú _trans_5Cr$Z digest_sizeÚintÚ from_bytesÚto_bytesÚrange)Z hash_nameZpasswordZsaltZ iterationsZdklenrr=Z blocksizer>ZdkeyZlooprLÚprevZrkeyÚirrrr ²sB         Zsha3_zcode for hash %s was not found.)zmd5zsha1zsha224zsha256zsha384zsha512)znewzalgorithms_guaranteedzalgorithms_availablez pbkdf2_hmac)Ú__doc__Z__always_supportedÚsetrr Ú__all__rrrr(r-r0r1r*rZ __get_hashÚunionZopenssl_md_meth_namesr#r rDrNrJrIZ __func_namerÚglobalsr$ZloggingZ exceptionrrrrÚ?sN           :