관리-도구
편집 파일: hotp.cpython-36.pyc
3 l�_w � @ s� d dl mZmZmZ d dlZd dlZd dlmZmZ d dl m Z d dlmZ d dl mZmZ d dlmZmZmZ d dlmZ d d lmZ G d d� de�ZdS )� )�absolute_import�division�print_functionN)�UnsupportedAlgorithm�_Reasons)�_get_backend)�HMACBackend)� constant_time�hmac)�SHA1�SHA256�SHA512)�InvalidToken)� _generate_uric @ s6 e Zd Zd dd�Zdd� Zdd� Zd d � Zdd� ZdS )�HOTPNTc C s� t |�}t|t�stdtj��t|�dk r:|dkr:td��t|tj �sNt d��|dk s^|dkrftd��t|ttt f�s~t d ��|| _|| _|| _|| _d S ) Nz.Backend object does not implement HMACBackend.� Tz'Key length has to be at least 128 bits.z)Length parameter must be an integer type.� � z(Length of HOTP has to be between 6 to 8.z)Algorithm must be SHA1, SHA256 or SHA512.)r � isinstancer r r ZBACKEND_MISSING_INTERFACE�len� ValueError�sixZ integer_types� TypeErrorr r r �_key�_length� _algorithm�_backend)�self�keyZlength� algorithmZbackendZenforce_key_length� r �/usr/lib64/python3.6/hotp.py�__init__ s"