ó
­«Y]c           @   s¦  d  d l  Z  d  d l Z d  d l Z d „  Z d „  Z d „  Z d „  Z e  j d Z e d1 k r d	 e d Ud
 e d d Ud Ge Gd GHne d k rô e	 e  j ƒ d k rô d  d l
 Z
 d e  j d d Ud e  j d Ge e
 e  j d ƒ GHn´ e d k rGe	 e  j ƒ d k rGd  d l
 Z
 d e  j d d Ud e  j d GHna e e e ƒ r“e e e e ƒ ƒ r“e e e ƒ Z d e Ge e e ƒ GHn d e d Ud e GHy e ƒ  Wn4 e k
 réHd GHd GHd GHd GHd GHd GHH‚  n Xe ƒ  e d d d  d! ƒ e d d" d  d# ƒ e d d$ d  d% ƒ e d d& d  d' ƒ e d d( d  d) ƒ e d d* d  d+ ƒ e d d, d  d- ƒ e d e ƒ  j d  d. ƒ e d d/ d  d0 ƒ d S(2   iÿÿÿÿNc           C   s   t  d ‚ d  S(   Ns   eek, creatorFunc not overridden(   t   RuntimeError(    (    (    s"   lib/python2.7/test/time_hashlib.pyt   creatorFunc   s    c   	      C   sŽ   d |  d } d |  } t  } t j ƒ  } x& t | ƒ D] } | | ƒ j ƒ  } q7 Wt j ƒ  } d | | Gd G| Gd Gt | ƒ Gd G| GHd  S(   NiÙž i   t   Zs   %2.2ft   secondst   xt   bytes(   R   t   timet   xranget   digestt   len(	   t   scalet   namet
   iterationst   longStrt   localCFt   startt   fR   t   end(    (    s"   lib/python2.7/test/time_hashlib.pyt   test_scaled_msg   s    
c          C   sQ   t  j  ƒ  }  x t d ƒ D] } t ƒ  } q Wt  j  ƒ  } d | |  Gd Gd GHd  S(   Ni N  s   %2.2fR   s   [20000 creations](   R   R   R   (   R   R   t   dR   (    (    s"   lib/python2.7/test/time_hashlib.pyt   test_create   s
    c          C   sW   t  j  ƒ  }  x# t d ƒ D] } t ƒ  j ƒ  } q Wt  j  ƒ  } d | |  Gd Gd GHd  S(   Ni N  s   %2.2fR   s   [20000 "" digests](   R   R   R   R   (   R   R   R   R   (    (    s"   lib/python2.7/test/time_hashlib.pyt	   test_zero   s
    i   t   _md5t   _shas   import s   creatorFunc = s   .news   testing speed of olds   legacy interfacet   _hashlibi   s   creatorFunc = _hashlib.%si   s   testing speed of _hashlib.%ss+   creatorFunc = lambda x=_hashlib.new : x(%r)s!   testing speed of _hashlib.new(%r)s   testing speed of hashlib.s*   creatorFunc = lambda x=hashlib.new : x(%r)s    testing speed of hashlib.new(%r)s8   pass argument(s) naming the hash to run a speed test on:s6    '_md5' and '_sha' test the legacy builtin md5 and shas=    '_hashlib' 'openssl_hName' 'fast' tests the builtin _hashlibs6    '_hashlib' 'hName' tests builtin _hashlib.new(shaFOO)s>    'hName' tests the hashlib.hName() implementation if it existss.            otherwise it uses hashlib.new(hName).R
   iÙž R   s   [huge data]i|)  s   [large data]i&  s   [medium data]i¨  s   [4*small data]iP  s   [3*small data]iÔ   s   [2*small data]ij   s   [small data]s   [digest_size data]i
   s   [tiny data](   R   R   (   t   sysR   t   hashlibR   R   R   R   t   argvt   hNameR	   R   t   getattrt   hasattrt   callablet
   ValueErrort   digest_size(    (    (    s"   lib/python2.7/test/time_hashlib.pyt   <module>   sZ   				
!'!$	