<s> """<STR_LIT>""" <EOL> import sys <EOL> _hashes = None <EOL> def _need_later_python ( alg ) : <EOL> def func ( * args , ** kwargs ) : <EOL> raise NotImplementedError ( "<STR_LIT>" + alg + <EOL> "<STR_LIT>" ) <EOL> return func <EOL> def _setup ( ) : <EOL> global _hashes <EOL> _hashes = { } <EOL> try : <EOL> import hashlib <EOL> _hashes [ '<STR_LIT>' ] = hashlib . md5 <EOL> _hashes [ '<STR_LIT>' ] = hashlib . sha1 <EOL> _hashes [ '<STR_LIT>' ] = hashlib . sha224 <EOL> _hashes [ '<STR_LIT>' ] = hashlib . sha256 <EOL> if sys . hexversion >= <NUM_LIT> : <EOL> _hashes [ '<STR_LIT>' ] = hashlib . sha384 <EOL> _hashes [ '<STR_LIT>' ] = hashlib . sha512 <EOL> else : <EOL> _hashes [ '<STR_LIT>' ] = _need_later_python ( '<STR_LIT>' ) <EOL> _hashes [ '<STR_LIT>' ] = _need_later_python ( '<STR_LIT>' ) <EOL> if sys . hexversion < <NUM_LIT> : <EOL> class HashlibWrapper : <EOL> def __init__ ( self , basehash ) : <EOL> self . basehash = basehash <EOL> self . digest_size = self . basehash ( ) . digest_size <EOL> def new ( self , * args , ** kwargs ) : <EOL> return self . basehash ( * args , ** kwargs ) <EOL> for name in _hashes : <EOL> _hashes [ name ] = HashlibWrapper ( _hashes [ name ] ) <EOL> except ImportError : <EOL> import md5 , sha <EOL> _hashes [ '<STR_LIT>' ] = md5 <EOL> _hashes [ '<STR_LIT>' ] = sha <EOL> def get ( algorithm ) : <EOL> if _hashes is None : <EOL> _setup ( ) <EOL> return _hashes [ algorithm . upper ( ) ] </s>
