AlkantarClanX12

Your IP : 3.137.219.68


Current Path : /opt/alt/python34/lib64/python3.4/__pycache__/
Upload File :
Current File : //opt/alt/python34/lib64/python3.4/__pycache__/hashlib.cpython-34.pyc

�
j fz&�@s�dZd!Zee�Zee�Zed"ZddlZd
d�ZiZdd�Z	dd�Z
dddd�Zdddd�Zy.ddl
Z
eZe
Zeje
j�ZWnek
r�eZe	ZYnXyddl
mZWn_ek
rLedd�ed�D��Zedd�ed�D��Zddd
�ZYnXxweD]oZy8ee�Zdekr�ee�Znee�e<WqTek
r�ddlZejd e�YqTXqTW[[[[[[
[dS)#a9
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.

If the underlying implementation supports "FIPS mode", and this is enabled, it
may restrict the available hashes to only those that are compliant with FIPS
regulations.  For example, it may deny the use of MD5, on the grounds that this
is not secure for uses such as authentication, system integrity checking, or
digital signatures.   If you need to use such a hash for non-security purposes
(such as indexing into a data structure for speed), you can override the keyword
argument "usedforsecurity" from True to False to signify that your code is not
relying on the hash for security purposes, and this will allow the hash to be
usable even in FIPS mode.

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_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.<locals>.inner)�	functools�wraps)rrr)rr�__ignore_usedforsecurityLs!rcCs[t}|j|�}|dk	r%|Sy�|dkrXddl}|j|d<|d<n�|dkr�ddl}|j|d<|d<n�|dkr�ddl}|j|d<|d	<|j|d<|d<nE|dkrddl	}|j
|d<|d
<|j|d
<|d<nWntk
r'YnX|j|�}|dk	rG|St
d|��dS)N�SHA1rr�MD5r�SHA256r�SHA224r�SHA512r�SHA384rzunsupported hash type )rzsha1)rzmd5)rzsha256rzsha224)rzsha512rzsha384)�__builtin_constructor_cache�get�_sha1r�_md5r�_sha256rr�_sha512rr�ImportError�
ValueError)�name�cache�constructorrr r!r"rrr�__get_builtin_constructor[s2
r(cCsQy(ttd|�}|dd�|SWn"ttfk
rLt|�SYnXdS)NZopenssl_rF)�getattr�_hashlib�AttributeErrorr$r()r%�frrr�__get_openssl_constructorys
r-�TcCst|�|�S)anew(name, data=b'', usedforsecurity=True) - Return a new hashing object using
    the named algorithm; optionally initialized with data (which must be bytes).
    The 'usedforsecurity' keyword argument does nothing, and is for compatibilty
    with the OpenSSL implementation
    )r()r%�datarrrr�__py_new�sr0cCs@ytj|||�SWn"tk
r;t|�|�SYnXdS)anew(name, data=b'', usedforsecurity=True) - Return a new hashing object using
    the named algorithm; optionally initialized with data (which must be bytes).
    
    Override 'usedforsecurity' to False when using for non-security purposes in
    a FIPS environment
    N)r*rr$r()r%r/rrrr�
__hash_new�s
r1)r
ccs|]}|dAVqdS)�\Nr)�.0�xrrr�	<genexpr>�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
|jt��|j
|jt
��||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.<locals>.prf�Nr.�Zbig)�
isinstance�str�	TypeError�bytes�	bytearray�
memoryviewrr)�lenr;r:�	translate�	_trans_36�	_trans_5Cr$Zdigest_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_availablezpbkdf2_hmac)�__doc__Z__always_supported�setrr	�__all__rrrr(r-r0r1r*rZ
__get_hash�unionZopenssl_md_meth_namesr#r
rDrNrJrIZ__func_namer�globalsr$ZloggingZ	exceptionrrrr�<module>?sN
	

: