관리-도구
편집 파일: concatkdf.cpython-36.pyc
3 l�_� � @ s� d dl mZmZmZ d dlZd dlmZ d dlmZm Z m Z mZ d dlm Z d dlmZ d dlmZ d dlmZmZmZ d d lmZ d d� Zdd � Zdd� Zeje�G dd� de��Zeje�G dd� de��ZdS )� )�absolute_import�division�print_functionN)�utils)�AlreadyFinalized� InvalidKey�UnsupportedAlgorithm�_Reasons)�_get_backend)�HMACBackend)�HashBackend)� constant_time�hashes�hmac)�KeyDerivationFunctionc C s t jd| �S )Nz>I)�struct�pack)�n� r �!/usr/lib64/python3.6/concatkdf.py� _int_to_u32be s r c C s8 | j d }||kr tdj|���|d k r4tjd|� d S )N� � � z(Can not derive keys larger than {} bits.� otherinfol l �� )Zdigest_size� ValueError�formatr �_check_bytes)� algorithm�lengthr Z max_lengthr r r �_common_args_checks s r c C s� t jd| � dg}d}d}xZ||krt|� }|jt|�� |j| � |j|� |j|j� � |t|d �7 }|d7 }qW dj|�d |� S )N�key_material� r r ���)r Z_check_byteslike�updater �append�finalize�len�join)r! r Zauxfnr �outputZoutlenZcounter�hr r r �_concatkdf_derive% s r+ c @ s. e Zd Zd dd�Zdd� Zdd� Zdd � ZdS )� ConcatKDFHashNc C s\ t |�}t|||� || _|| _|| _| jd kr6d| _t|t�sLtdtj ��|| _ d| _d S )Nr"