Your IP : 13.58.191.60


Current Path : /usr/lib64/python3.6/site-packages/cryptography/hazmat/primitives/__pycache__/
Upload File :
Current File : //usr/lib64/python3.6/site-packages/cryptography/hazmat/primitives/__pycache__/hmac.cpython-36.pyc

3

T��e1	�@s�ddlmZmZmZddlmZddlmZmZm	Z	ddl
mZddlm
Z
ddlmZmZejej�ejej�Gdd�de���Zd	S)
�)�absolute_import�division�print_function)�utils)�AlreadyFinalized�UnsupportedAlgorithm�_Reasons)�_get_backend)�HMACBackend)�hashes�macc@s@eZdZd
dd�Zejd�Zdd�Zdd�Zd	d
�Z	dd�Z
dS)�HMACNcCsjt|�}t|t�stdtj��t|tj�s2td��||_	||_
||_|dkr`|j
j||j
�|_n||_dS)Nz.Backend object does not implement HMACBackend.z*Expected instance of hashes.HashAlgorithm.)r	�
isinstancer
rrZBACKEND_MISSING_INTERFACErZ
HashAlgorithm�	TypeError�
_algorithm�_backend�_keyZcreate_hmac_ctx�	algorithm�_ctx)�self�keyr�backend�ctx�r�/usr/lib64/python3.6/hmac.py�__init__s
z
HMAC.__init__rcCs.|jdkrtd��tjd|�|jj|�dS)NzContext was already finalized.�data)rrrZ_check_byteslike�update)rrrrrr*s
zHMAC.updatecCs.|jdkrtd��t|j|j|j|jj�d�S)NzContext was already finalized.)rr)rrr
rrr�copy)rrrrr0s
z	HMAC.copycCs&|jdkrtd��|jj�}d|_|S)NzContext was already finalized.)rr�finalize)rZdigestrrrr:s


z
HMAC.finalizecCs:tjd|�|jdkrtd��|jd}|_|j|�dS)N�	signaturezContext was already finalized.)r�_check_bytesrr�verify)rr rrrrr"As

zHMAC.verify)NN)�__name__�
__module__�__qualname__rrZread_only_propertyrrrrr"rrrrr
s


r
N)Z
__future__rrrZcryptographyrZcryptography.exceptionsrrrZcryptography.hazmat.backendsr	Z'cryptography.hazmat.backends.interfacesr
Zcryptography.hazmat.primitivesrrZregister_interfaceZ
MACContextZHashContext�objectr
rrrr�<module>s


?>