ó {G_Tc@s¦ddlZddlZddlZd„Zd„Zd„Zd„ZejdZed1krd edUd ed dUd GeGd GHnedkrôe ejƒdkrôddl Z dejddUdejdGe e ejdƒGHn´edkrGe ejƒdkrGddl Z dejddUdejdGHnae eeƒr“e e eeƒƒr“e eeƒZdeGe eeƒGHndedUdeGHy eƒWn4ek réHdGHdGHdGHdGHdGHdGHH‚nXeƒeddd d!ƒedd"d d#ƒedd$d d%ƒedd&d d'ƒedd(d d)ƒedd*d d+ƒedd,d d-ƒedeƒjd d.ƒedd/d d0ƒdS(2iÿÿÿÿNcCs td‚dS(Nseek, creatorFunc not overridden(t RuntimeError(((s-/usr/local/lib/python2.7/test/time_hashlib.pyt creatorFuncsc CsŽd|d}d|}t}tjƒ}x&t|ƒD]}||ƒjƒ}q7Wtjƒ}d||GdG|GdGt|ƒGdG|GHdS(NiÙžitZs%2.2ftsecondstxtbytes(Rttimetxrangetdigesttlen( tscaletnamet iterationstlongStrtlocalCFtstarttfRtend((s-/usr/local/lib/python2.7/test/time_hashlib.pyttest_scaled_msg s   cCsQtjƒ}xtdƒD]}tƒ}qWtjƒ}d||GdGdGHdS(Ni Ns%2.2fRs[20000 creations](RRR(RRtdR((s-/usr/local/lib/python2.7/test/time_hashlib.pyt test_creates    cCsWtjƒ}x#tdƒD]}tƒjƒ}qWtjƒ}d||GdGdGHdS(Ni Ns%2.2fRs[20000 "" digests](RRRR(RRRR((s-/usr/local/lib/python2.7/test/time_hashlib.pyt test_zeros   it_md5t_shasimport screatorFunc = s.newstesting speed of oldslegacy interfacet_hashlibiscreatorFunc = _hashlib.%sistesting speed of _hashlib.%ss+creatorFunc = lambda x=_hashlib.new : x(%r)s!testing speed of _hashlib.new(%r)stesting speed of hashlib.s*creatorFunc = lambda x=hashlib.new : x(%r)s testing speed of hashlib.new(%r)s8pass 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]iPs[3*small data]iÔs[2*small data]ijs [small data]s[digest_size data]i s [tiny data](RR(tsysRthashlibRRRRtargvthNameR Rtgetattrthasattrtcallablet ValueErrort digest_size(((s-/usr/local/lib/python2.7/test/time_hashlib.pytsZ      ! '! $