mς
­fIc           @   s±   d  k  Z  d  k Z d  k Z d k l Z d e i f d     YZ d e i f d     YZ d e i f d     YZ d e i f d	     YZ	 d
   Z
 e d j o e
   n d  S(   N(   s   test_supportt   TestVectorsTestCasec           B   s   t  Z d   Z d   Z RS(   Nc            sω     d   } | t d  d d d  | d d d  | t d	  d t d
  d d  | d i g  } t d d  D] } | t |  qw ~  t d  d d  | t d  d d d  | t d	  d d d  | t d	  d d d  d  S(   Nc            s8   t  i |  |  }   i | i   i   | i    d  S(   N(
   t   hmact   HMACt   keyt   datat   ht   selft   assertEqualt	   hexdigestt   uppert   digest(   R   R   R
   R   (   R   (    t+   /mit/python/lib/python2.4/test/test_hmac.pyt   md5test   s    i   i   s   Hi Theret    9294727A3638BB1C13F48EF8158BFC9Dt   Jefes   what do ya want for nothing?t    750c783e6ab0b503eaa86e310a5db738iͺ   iέ   i2   t    56be34521d144c88dbb8c733f0e8b3f6t    i   i   iΝ   t    697eaf0aca3a3aea3a75164746ffaa79i   s   Test With Truncationt    56461ef2342edc00f9bab995690efd4ciP   s6   Test Using Larger Than Block-Size Key - Hash Key Firstt    6b1ab7fe4bd7bf8f0b62e6ce61b9d0cdsI   Test Using Larger Than Block-Size Key and Larger Than One Block-Size Datat    6f630fad67cda0ee1fb1f562db3aa53e(   R   t   chrt   joint   _[1]t   ranget   i(   R   R   R   R   (    (   R   R   t   test_md5_vectors   s,    9c            sω     d   } | t d  d d d  | d d d  | t d	  d t d
  d d  | d i g  } t d d  D] } | t |  qw ~  t d  d d  | t d  d d d  | t d	  d d d  | t d	  d d d  d  S(   Nc            s>   t  i |  | d t }   i | i   i	   | i	    d  S(   Nt	   digestmod(   R   R   R   R   t   shaR   R   R   R   R	   R
   (   R   R   R
   R   (   R   (    R   t   shatest-   s    i   i   s   Hi Theret(   b617318655057264e28bc0b6fb378c8ef146be00R   s   what do ya want for nothing?t(   effcdf6ae5eb2fa2d27416d5f184df9c259a7c79iͺ   iέ   i2   t(   125d7342b9ac11cd91a39af48aa17b4f63f175d3R   i   i   iΝ   t(   4c9007f4026250c6bc8414f9bf50c86c2d7235dai   s   Test With Truncationt(   4c1a03424b55e07fe7f27be1d58bb9324a9a5a04iP   s6   Test Using Larger Than Block-Size Key - Hash Key Firstt(   aa4ae5e15272d00e95705637ce8a3b55ed402112sI   Test Using Larger Than Block-Size Key and Larger Than One Block-Size Datat(   e8e99d0f45237d786d6bbaa7965c7808bbff1a91(   R   R   R   R   R   R   (   R   R   R   R   (    (   R   R   t   test_sha_vectors,   s,    9(   t   __name__t
   __module__R   R&   (    (    (    R   R       s   	$t   ConstructorTestCasec           B   s#   t  Z d   Z d   Z d   Z RS(   Nc         C   s4   d } y t i d  } Wn |  i d  n Xd  S(   Ni    R   s+   Standard constructor call raised exception.(   t   failedR   R   R   R   t   fail(   R   R*   R   (    (    R   t   test_normalQ   s
    c         C   s1   y t  i d d  } Wn |  i d  n Xd  S(   NR   s
   hash this!s5   Constructor call with text argument raised exception.(   R   R   R   R   R+   (   R   R   (    (    R   t   test_withtextY   s    c         C   s=   d  k  } y t i d d |  } Wn |  i d  n Xd  S(   NR   R   s2   Constructor call with sha module raised exception.(   R   R   R   R   R   R+   (   R   R   R   (    (    R   t   test_withmodule`   s
    	(   R'   R(   R,   R-   R.   (    (    (    R   R)   O   s   		t   SanityTestCasec           B   s   t  Z d   Z d   Z RS(   Nc         C   s2   d  k  } t i d  } |  i | i | j  d  S(   NR   (   t   md5R   R   R   R   t
   failUnlessR   (   R   R   R0   (    (    R   t   test_default_is_md5j   s    	c         C   s_   yD t  i d  } | i d  | i   } | i   } | i   } Wn |  i
 d  n Xd  S(   Ns   my secret keys   compute the hash of this text!s3   Exception raised during normal usage of HMAC class.(   R   R   R   t   updateR
   t   digR   t   copyt   h2R   R+   (   R   R6   R   R4   (    (    R   t   test_exercise_all_methodsp   s    (   R'   R(   R2   R7   (    (    (    R   R/   h   s   	t   CopyTestCasec           B   s#   t  Z d   Z d   Z d   Z RS(   Nc         C   s   t  i d  } | i   } |  i | i | i j d  |  i t | i	  t | i	  j d  |  i t | i
  t | i
  j d  d  S(   NR   s   Modules don't match.s   Types of inner don't match.s   Types of outer don't match.(   R   R   t   h1R5   R6   R   R1   R   t   typet   innert   outer(   R   R6   R9   (    (    R   t   test_attributes~   s    !!c         C   s   t  i d  } | i   } |  i t |  t |  j d  |  i t | i  t | i  j d  |  i t | i	  t | i	  j d  d  S(   NR   s"   No real copy of the HMAC instance.s&   No real copy of the attribute 'inner'.s&   No real copy of the attribute 'outer'.(
   R   R   R9   R5   R6   R   R1   t   idR;   R<   (   R   R6   R9   (    (    R   t   test_realcopy   s    "!!c         C   sp   t  i d  } | i d  | i   } |  i | i   | i   j d  |  i | i	   | i	   j d  d  S(   NR   s   some random texts-   Digest of copy doesn't match original digest.s3   Hexdigest of copy doesn't match original hexdigest.(
   R   R   R9   R3   R5   R6   R   R1   R
   R   (   R   R6   R9   (    (    R   t   test_equality   s    (   R'   R(   R=   R?   R@   (    (    (    R   R8   |   s   		c           C   s   t  i t t t t  d  S(   N(   t   test_supportt   run_unittestR    R)   R/   R8   (    (    (    R   t	   test_main   s    	t   __main__(   R   R   t   unittestt   testRA   t   TestCaseR    R)   R/   R8   RC   R'   (	   RA   R/   RE   R   RC   R)   R    R   R8   (    (    R   t   ?   s   			I"	