File: //opt/alt/python27/lib/python2.7/site-packages/beaker/crypto/pbkdf2.pyo
�
7Y�Kc           @   s�   d  Z  d d l m Z d d l m Z d d l m Z d d l m Z d d l	 m
 Z m Z
 d �  Z d e f d	 �  �  YZ d d d
 � Z e e � e _ d �  Z d �  Z e d
 k r� e �  n  d S(   s   1.1i����(   t   pack(   t   b2a_hex(   t   randint(   t	   b64encode(   t   hmact	   hmac_sha1c         C   sE   d j  g  t |  | � D]( \ } } t t | � t | � A� ^ q � S(   Nt    (   t   joint   zipt   chrt   ord(   t   at   bt   xt   y(    (    sE   /opt/alt/python27/lib/python2.7/site-packages/beaker/crypto/pbkdf2.pyt   strxorM   s    t   PBKDF2c           B   sV   e  Z d  Z d e e d � Z d �  Z d �  Z d �  Z d �  Z	 d �  Z
 d �  Z RS(	   s�  PBKDF2.py : PKCS#5 v2.0 Password-Based Key Derivation
    
    This implementation takes a passphrase and a salt (and optionally an
    iteration count, a digest module, and a MAC module) and provides a
    file-like object from which an arbitrarily-sized key can be read.
    If the passphrase and/or salt are unicode objects, they are encoded as
    UTF-8 before they are processed.
    The idea behind PBKDF2 is to derive a cryptographic key from a
    passphrase and a salt.
    
    PBKDF2 may also be used as a strong salted password hash.  The
    'crypt' function is provided for that purpose.
    
    Remember: Keys generated using PBKDF2 are only as strong as the
    passphrases they are derived from.
    i�  c         C   sG   t  | � s | j } n  | |  _ | |  _ |  j | | | |  j � d  S(   N(   t   callablet   newt   _PBKDF2__macmodulet   _PBKDF2__digestmodulet   _setupt
   _pseudorandom(   t   selft
   passphraset   saltt
   iterationst   digestmodulet	   macmodule(    (    sE   /opt/alt/python27/lib/python2.7/site-packages/beaker/crypto/pbkdf2.pyt   __init__d   s
    		c         C   s%   |  j  d | d | d |  j � j �  S(   s&