Viewing File: /opt/alt/python35/lib64/python3.5/__pycache__/hashlib.cpython-35.opt-2.pyc



й¼]+ã@sždZdZeeƒZeeƒZedZiZdd„Zd
d„Zddd„Z	ddd„Z
y.ddlZe
ZeZ
ejejƒZWnek
r¸e	ZeZ
YnXyddlmZWn_ek
r.edd„edƒDƒƒZedd„edƒDƒƒZddd
„ZYnXxVeD]NZye
eƒeƒe<Wq6ek
rƒddlZejdeƒYq6Xq6W[[[
[	[
[dS)a¨hashlib module - A common interface to many hash functions.

new(name, data=b'') - returns a new hash object implementing the
                      given hash function; initializing the hash
                      using the given binary data.

Named constructor functions are also available, these are faster
than using new(name):

md5(), sha1(), sha224(), sha256(), sha384(), and sha512()

More algorithms may be available on your platform but the above are guaranteed
to exist.  See the algorithms_guaranteed and algorithms_available attributes
to find out what algorithm names can be passed to new().

NOTE: If you want the adler32 or crc32 hash functions they are available in
the zlib module.

Choose your hash function wisely.  Some have known collision weaknesses.
sha384 and sha512 will be slow on 32 bit platforms.

Hash objects have these methods:
 - update(arg): Update the hash object with the bytes in arg. Repeated calls
                are equivalent to a single call with the concatenation of all
                the arguments.
 - digest():    Return the digest of the bytes passed to the update() method
                so far.
 - hexdigest(): Like digest() except the digest is returned as a unicode
                object of double length, containing only hexadecimal digits.
 - copy():      Return a copy (clone) of the hash object. This can be used to
                efficiently compute the digests of strings that share a common
                initial substring.

For example, to obtain the digest of the string 'Nobody inspects the
spammish repetition':

    >>> 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_hmaccCsXt}|j|ƒ}|dk	r%|Syë|dkrXddl}|j|d<|d<n·|dkrˆddl}|j|d<|d<n‡|dkrÍddl}|j|d<|d	<|j|d<|d<nB|dkrddl	}|j
|d<|d
<|j|d
<|d<Wntk
r$YnX|j|ƒ}|dk	rD|St
d|ƒ‚dS)NÚSHA1réÚMD5rÚSHA256rÚSHA224rÚSHA512rÚSHA384rzunsupported hash type )rr)r
r)rrrr)rrrr)Ú__builtin_constructor_cacheÚgetÚ_sha1rÚ_md5rÚ_sha256rrÚ_sha512rrÚImportErrorÚ
ValueError)ÚnameÚcacheÚconstructorrrrr©rú,/opt/alt/python35/lib64/python3.5/hashlib.pyÚ__get_builtin_constructorDs2
rcCsKy"ttd|ƒ}|ƒ|SWn"ttfk
rFt|ƒSYnXdS)NZopenssl_)ÚgetattrÚ_hashlibÚAttributeErrorrr)rÚfrrrÚ__get_openssl_constructorbsr$ócCst|ƒ|ƒS)N)r)rÚdatarrrÚ__py_newnsr'cCs=ytj||ƒSWn"tk
r8t|ƒ|ƒSYnXdS)N)r!rrr)rr&rrrÚ
__hash_newus
r(rN)r
ccs|]}|dAVqdS)é\Nr)Ú.0Úxrrrú	<genexpr>‘sr,éccs|]}|dAVqdS)é6Nr)r*r+rrrr,’scCst|tƒst|ƒ‚t|ttfƒsBtt|ƒƒ}t|ttfƒsitt|ƒƒ}t|ƒ}t|ƒ}t|ddƒ}t|ƒ|krºt||ƒj	ƒ}|d|t|ƒ}|j
|jtƒƒ|j
|jt
ƒƒ||dd„}|dkr(t|ƒ‚|dkr=|j}|dkrUt|ƒ‚d}	d}
tj}x¡t|	ƒ|kr
|||
jdd	ƒƒ}tj|d	ƒ}
x7t|dƒD]%}||ƒ}|
||d	ƒN}
q¾W|
d7}
|	|
j|jd	ƒ7}	qmW|	d|…S)
NÚ
block_sizeé@scSsB|jƒ}|jƒ}|j|ƒ|j|jƒƒ|jƒS)N)ÚcopyÚupdateÚdigest)ÚmsgÚinnerÚouterZicpyZocpyrrrÚprf­s

zpbkdf2_hmac.<locals>.prfér%éÚbig)Ú
isinstanceÚstrÚ	TypeErrorÚbytesÚ	bytearrayÚ
memoryviewrr Úlenr3r2Ú	translateÚ	_trans_36Ú	_trans_5CrÚdigest_sizeÚintÚ
from_bytesÚto_bytesÚrange)Z	hash_nameZpasswordZsaltZ
iterationsZdklenr5r6Ú	blocksizer7ZdkeyZlooprGÚprevZrkeyÚirrrr
”sB			
zcode for hash %s was not found.)rrrrrr)rrr	r
)Ú__doc__Z__always_supportedÚsetrr	Ú__all__rrr$r'r(r!rZ
__get_hashÚunionÚopenssl_md_meth_namesrr
r>rIrDrCZ__func_nameÚglobalsrÚloggingÚ	exceptionrrrrÚ<module>5sB

:

	
Back to Directory File Manager