관리-도구
편집 파일: hmac.cpython-36.opt-1.pyc
3 T��e1 � @ s� d dl mZmZmZ d dlmZ d dlmZmZm Z d dl mZ d dlm Z d dlmZmZ ejej�ejej�G dd� de���Zd S ) � )�absolute_import�division�print_function)�utils)�AlreadyFinalized�UnsupportedAlgorithm�_Reasons)�_get_backend)�HMACBackend)�hashes�macc @ s@ e Zd Zd dd�Zejd�Zdd� Zdd� Zd d � Z dd� Z dS )�HMACNc C sj t |�}t|t�stdtj��t|tj�s2td��|| _ || _ || _|d kr`| j j|| j �| _n|| _d S )Nz.Backend object does not implement HMACBackend.z*Expected instance of hashes.HashAlgorithm.)r � isinstancer r r ZBACKEND_MISSING_INTERFACEr Z 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__r c C s. | j d krtd��tjd|� | j j|� d S )NzContext was already finalized.�data)r r r Z_check_byteslike�update)r r r r r r * s zHMAC.updatec C s. | j d krtd��t| j| j| j| j j� d�S )NzContext was already finalized.)r r )r r r r r r �copy)r r r r r 0 s z HMAC.copyc C s&