Ńň
Ě6¸Lc           @   sQ   d  Z  d d k Z d d k l Z d d k l Z l Z d d  Z d   Z	 d S(   s3   
Django's standard crypto functions and utilities.
i˙˙˙˙N(   t   settings(   t   sha_constructort   sha_hmacc         C   sI   | d j o t i } n t |  |  i   } t i | d | d t S(   sÖ   
    Returns the HMAC-SHA1 of 'value', using a key generated from key_salt and a
    secret (which defaults to settings.SECRET_KEY).

    A different key_salt should be passed in for every application of HMAC.
    t   msgt	   digestmodN(   t   NoneR    t
   SECRET_KEYR   t   digestt   hmact   newR   (   t   key_saltt   valuet   secrett   key(    (    s=   /usr/local/lib/python2.6/dist-packages/django/utils/crypto.pyt   salted_hmac
   s    c         C   sh   t  |   t  |  j o t Sd } x7 t |  |  D]& \ } } | t |  t |  AO} q4 W| d j S(   s   
    Returns True if the two strings are equal, False otherwise.

    The time taken is independent of the number of characters that match.
    i    (   t   lent   Falset   zipt   ord(   t   val1t   val2t   resultt   xt   y(    (    s=   /usr/local/lib/python2.6/dist-packages/django/utils/crypto.pyt   constant_time_compare"   s     (
   t   __doc__R   t   django.confR    t   django.utils.hashcompatR   R   R   R   R   (    (    (    s=   /usr/local/lib/python2.6/dist-packages/django/utils/crypto.pyt   <module>   s
   