File: //lib64/python3.6/__pycache__/hmac.cpython-36.pyc
3
i @ s d Z ddlZddlmZ ddlZddlZddl Z e
dd edD Ze
dd edD Z
dZG dd d Zd
d ZG dd
d
e jZej reZdddZdS )zxHMAC (Keyed-Hashing for Message Authentication) Python module.
Implements the HMAC algorithm as described by RFC 2104.
N)_compare_digestc c s | ]}|d A V qdS )\ N ).0xr r /usr/lib64/python3.6/hmac.py <genexpr> s r c c s | ]}|d A V qdS )6 Nr )r r r r r r
s c @ sR e Zd ZdZdZdddZedd Zdd Zd
d Z dd
Z
dd Zdd ZdS )HMACz~RFC 2104 HMAC class. Also complies with RFC 4231.
This supports the API for Cryptographic Hash Functions (PEP 247).
@ Nc sf t j rtdt|ttfs0tdt|j dkrLt j
dtd tj
t r\ | _n,t trxd fdd | _nd fd
d | _| j | _| j | _| jj| _t| jdr| jj}|dk rt j
d
|| jf td | j}nt j
d| j td | j}|| _t||kr| j|j }|j|d}| jj|jt | jj|jt |dk rb| j| dS )a1 Create a new HMAC object.
key: key for the keyed hash object.
msg: Initial input for the hash, if provided.
digestmod: A module supporting PEP 247. *OR*
A hashlib constructor returning a new hash object. *OR*
A hash name suitable for hashlib.new().
Defaults to hashlib.md5.
Implicit default to hashlib.md5 is deprecated and will be
removed in Python 3.6.
Note: key and msg must be a bytes or bytearray objects.
z*This class is not available in FIPS mode. zUse hmac.new().z,key: expected bytes or bytearray, but got %rNz<HMAC() without an explicit digestmod argument is deprecated. c s t j | S )N)_hashlibnew)d) digestmodr r <lambda>; s zHMAC.__init__.<locals>.<lambda>c s
j | S )N)r )r )r r r r = s
block_size z:block_size of %d seems too small; using our default of %d.z<No block_size attribute on given digest object; Assuming %d. z9This class is not available in FIPS mode. Use hmac.new().)r )r )_hashlibopenssl
get_fips_mode
ValueError
isinstancebytes bytearray TypeErrortype__name__ _warningswarnPendingDeprecationWarningr Zmd5callabledigest_consstrouterinnerdigest_sizehasattrr blocksizeRuntimeWarninglendigestljustupdate translatetrans_5Ctrans_36)selfkeymsgr r* r )r r __init__ sJ
z
HMAC.__init__c C s d| j j S )Nzhmac-)r' name)r3 r r r r7 ] s z HMAC.namec C s t j rtd| jj| dS )z8Update this hashing object with the string msg.
z'hmac.HMAC is not available in FIPS modeN)r r r r' r/ )r3 r5 r r r r/ a s zHMAC.updatec C s: | j j| j }| j|_| j|_| jj |_| jj |_|S )zyReturn a separate copy of this hashing object.
An update to this copy won't affect the original object.
) __class____new__r$ r( r' copyr&