/opt/alt/python34/lib64/python3.4
NameSizeModeActions
asyncio/-0755rm
collections/-0755rm
concurrent/-0755rm
config-3.4m/-0755rm
ctypes/-0755rm
curses/-0755rm
dbm/-0755rm
distutils/-0755rm
email/-0755rm
encodings/-0755rm
ensurepip/-0755rm
html/-0755rm
http/-0755rm
idlelib/-0755rm
importlib/-0755rm
json/-0755rm
lib-dynload/-0755rm
lib2to3/-0755rm
logging/-0755rm
multiprocessing/-0755rm
plat-linux/-0755rm
pydoc_data/-0755rm
site-packages/-0755rm
sqlite3/-0755rm
test/-0755rm
unittest/-0755rm
urllib/-0755rm
venv/-0755rm
wsgiref/-0755rm
xml/-0755rm
xmlrpc/-0755rm
__pycache__/-0755rm
abc.py86240644editdlrm
aifc.py315780644editdlrm
antigravity.py4750644editdlrm
argparse.py900270644editdlrm
ast.py120340644editdlrm
asynchat.py118250644editdlrm
asyncore.py209980644editdlrm
base64.py201800755editdlrm
bdb.py233540644editdlrm
binhex.py139280644editdlrm
bisect.py25950644editdlrm
bz2.py188600644editdlrm
calendar.py229410644editdlrm
cgi.py359410755editdlrm
cgitb.py120410644editdlrm
chunk.py54250644editdlrm
cmd.py148600644editdlrm
code.py100370644editdlrm
codecs.py359100644editdlrm
codeop.py59940644editdlrm
colorsys.py40640644editdlrm
compileall.py96180644editdlrm
configparser.py496980644editdlrm
contextlib.py116390644editdlrm
copy.py90050644editdlrm
copyreg.py68330644editdlrm
cProfile.py53240755editdlrm
crypt.py18790644editdlrm
csv.py161850644editdlrm
datetime.py758040644editdlrm
decimal.py2286880644editdlrm
difflib.py816840644editdlrm
dis.py171600644editdlrm
doctest.py1044920644editdlrm
dummy_threading.py28150644editdlrm
enum.py215380644editdlrm
filecmp.py98300644editdlrm
fileinput.py148650644editdlrm
fnmatch.py31630644editdlrm
formatter.py151730644editdlrm
fractions.py232030644editdlrm
ftplib.py385320644editdlrm
functools.py285110644editdlrm
genericpath.py38820644editdlrm
getopt.py74890644editdlrm
getpass.py60690644editdlrm
gettext.py207670644editdlrm
glob.py34610644editdlrm
gzip.py243140644editdlrm
hashlib.py98500644editdlrm
heapq.py179970644editdlrm
hmac.py50630644editdlrm
imaplib.py502670644editdlrm
imghdr.py35280644editdlrm
imp.py99840644editdlrm
inspect.py1046400644editdlrm
io.py33960644editdlrm
ipaddress.py715980644editdlrm
keyword.py22220755editdlrm
linecache.py39530644editdlrm
locale.py745300644editdlrm
lzma.py193710644editdlrm
macpath.py56190644editdlrm
macurl2path.py27320644editdlrm
mailbox.py783820644editdlrm
mailcap.py74370644editdlrm
mimetypes.py207810644editdlrm
modulefinder.py234210644editdlrm
netrc.py57480644editdlrm
nntplib.py430820644editdlrm
ntpath.py204770644editdlrm
nturl2path.py24440644editdlrm
numbers.py102430644editdlrm
opcode.py54420644editdlrm
operator.py91950644editdlrm
optparse.py603460644editdlrm
os.py338820644editdlrm
pathlib.py424670644editdlrm
pdb.py609920755editdlrm
pickle.py559890644editdlrm
pickletools.py917620644editdlrm
pipes.py89160644editdlrm
pkgutil.py212150644editdlrm
platform.py467610755editdlrm
plistlib.py317910644editdlrm
poplib.py143190644editdlrm
posixpath.py134480644editdlrm
pprint.py149190644editdlrm
profile.py220320755editdlrm
pstats.py263160644editdlrm
pty.py47630644editdlrm
pyclbr.py135200644editdlrm
pydoc.py1030110755editdlrm
py_compile.py71030644editdlrm
queue.py88350644editdlrm
quopri.py72650755editdlrm
random.py260840644editdlrm
re.py156040644editdlrm
reprlib.py51100644editdlrm
rlcompleter.py60690644editdlrm
runpy.py108160644editdlrm
sched.py63540644editdlrm
selectors.py170970644editdlrm
shelve.py85280644editdlrm
shlex.py115480644editdlrm
shutil.py399020644editdlrm
site.py215530644editdlrm
smtpd.py299910755editdlrm
smtplib.py389710755editdlrm
sndhdr.py62560644editdlrm
socket.py190670644editdlrm
socketserver.py243720644editdlrm
sre_compile.py199030644editdlrm
sre_constants.py72670644editdlrm
sre_parse.py314290644editdlrm
ssl.py347470644editdlrm
stat.py44000644editdlrm
statistics.py195560644editdlrm
string.py114450644editdlrm
stringprep.py129170644editdlrm
struct.py2570644editdlrm
subprocess.py645490644editdlrm
sunau.py180950644editdlrm
symbol.py20530755editdlrm
symtable.py74040644editdlrm
sysconfig.py246320644editdlrm
tabnanny.py114100755editdlrm
tarfile.py915570755editdlrm
telnetlib.py230740644editdlrm
tempfile.py225250644editdlrm
textwrap.py192820644editdlrm
this.py10030644editdlrm
threading.py488020644editdlrm
timeit.py119720755editdlrm
token.py30340644editdlrm
tokenize.py255960644editdlrm
trace.py314870755editdlrm
traceback.py111670644editdlrm
tracemalloc.py156510644editdlrm
tty.py8790644editdlrm
types.py54110644editdlrm
uu.py67660755editdlrm
uuid.py237240644editdlrm
warnings.py143030644editdlrm
wave.py176820644editdlrm
weakref.py193840644editdlrm
webbrowser.py214320755editdlrm
xdrlib.py59130644editdlrm
zipfile.py685470644editdlrm
_bootlocale.py13010644editdlrm
_collections_abc.py198980644editdlrm
_compat_pickle.py83180644editdlrm
_dummy_thread.py48720644editdlrm
_markupbase.py145980644editdlrm
_osx_support.py191010644editdlrm
_pyio.py738930644editdlrm
_sitebuiltins.py31150644editdlrm
_strptime.py220530644editdlrm
_sysconfigdata.py244800644editdlrm
_threading_local.py74100644editdlrm
_weakrefset.py57050644editdlrm
__future__.py45840644editdlrm
__phello__.foo.py640644editdlrm
Edit: /opt/alt/python34/lib64/python3.4/hashlib.py (9850B)
#. Copyright (C) 2005-2010 Gregory P. Smith (greg@krypto.org) # Licensed to PSF under a Contributor Agreement. # __doc__ = """hashlib module - A common interface to many hash functions. new(name, data=b'') - returns a new hash object implementing the given hash function; initializing the hash using the given binary data. Named constructor functions are also available, these are faster than using new(name): md5(), sha1(), sha224(), sha256(), sha384(), and sha512() More algorithms may be available on your platform but the above are guaranteed to exist. See the algorithms_guaranteed and algorithms_available attributes to find out what algorithm names can be passed to new(). NOTE: If you want the adler32 or crc32 hash functions they are available in the zlib module. Choose your hash function wisely. Some have known collision weaknesses. sha384 and sha512 will be slow on 32 bit platforms. If the underlying implementation supports "FIPS mode", and this is enabled, it may restrict the available hashes to only those that are compliant with FIPS regulations. For example, it may deny the use of MD5, on the grounds that this is not secure for uses such as authentication, system integrity checking, or digital signatures. If you need to use such a hash for non-security purposes (such as indexing into a data structure for speed), you can override the keyword argument "usedforsecurity" from True to False to signify that your code is not relying on the hash for security purposes, and this will allow the hash to be usable even in FIPS mode. Hash objects have these methods: - update(arg): Update the hash object with the bytes in arg. Repeated calls are equivalent to a single call with the concatenation of all the arguments. - digest(): Return the digest of the bytes passed to the update() method so far. - hexdigest(): Like digest() except the digest is returned as a unicode object of double length, containing only hexadecimal digits. - copy(): Return a copy (clone) of the hash object. This can be used to efficiently compute the digests of strings that share a common initial substring. For example, to obtain the digest of the string 'Nobody inspects the spammish repetition': >>> import hashlib >>> m = hashlib.md5() >>> m.update(b"Nobody inspects") >>> m.update(b" the spammish repetition") >>> m.digest() b'\\xbbd\\x9c\\x83\\xdd\\x1e\\xa5\\xc9\\xd9\\xde\\xc9\\xa1\\x8d\\xf0\\xff\\xe9' More condensed: >>> hashlib.sha224(b"Nobody inspects the spammish repetition").hexdigest() 'a4337bc45a8fc544c03f52dc550cd6e1e87021bc896588bd79e901e2' """ # This tuple and __get_builtin_constructor() must be modified if a new # always available algorithm is added. __always_supported = ('md5', 'sha1', 'sha224', 'sha256', 'sha384', 'sha512') algorithms_guaranteed = set(__always_supported) algorithms_available = set(__always_supported) __all__ = __always_supported + ('new', 'algorithms_guaranteed', 'algorithms_available', 'pbkdf2_hmac') import functools def __ignore_usedforsecurity(func): """Used for sha3_* functions. Until OpenSSL implements them, we want to use them from Python _sha3 module, but we want them to accept usedforsecurity argument too.""" # TODO: remove this function when OpenSSL implements sha3 @functools.wraps(func) def inner(*args, **kwargs): if 'usedforsecurity' in kwargs: kwargs.pop('usedforsecurity') return func(*args, **kwargs) return inner __builtin_constructor_cache = {} def __get_builtin_constructor(name): cache = __builtin_constructor_cache constructor = cache.get(name) if constructor is not None: return constructor try: if name in ('SHA1', 'sha1'): import _sha1 cache['SHA1'] = cache['sha1'] = _sha1.sha1 elif name in ('MD5', 'md5'): import _md5 cache['MD5'] = cache['md5'] = _md5.md5 elif name in ('SHA256', 'sha256', 'SHA224', 'sha224'): import _sha256 cache['SHA224'] = cache['sha224'] = _sha256.sha224 cache['SHA256'] = cache['sha256'] = _sha256.sha256 elif name in ('SHA512', 'sha512', 'SHA384', 'sha384'): import _sha512 cache['SHA384'] = cache['sha384'] = _sha512.sha384 cache['SHA512'] = cache['sha512'] = _sha512.sha512 except ImportError: pass # no extension module, this hash is unsupported. constructor = cache.get(name) if constructor is not None: return constructor raise ValueError('unsupported hash type ' + name) def __get_openssl_constructor(name): try: f = getattr(_hashlib, 'openssl_' + name) # Allow the C module to raise ValueError. The function will be # defined but the hash not actually available thanks to OpenSSL. # We pass "usedforsecurity=False" to disable FIPS-based restrictions: # at this stage we're merely seeing if the function is callable, # rather than using it for actual work. f(usedforsecurity=False) # Use the C function directly (very fast) return f except (AttributeError, ValueError): # TODO: We want to just raise here when OpenSSL implements sha3 # because we want to make sure that Fedora uses everything from OpenSSL return __get_builtin_constructor(name) def __py_new(name, data=b'', usedforsecurity=True): """new(name, data=b'', usedforsecurity=True) - Return a new hashing object using the named algorithm; optionally initialized with data (which must be bytes). The 'usedforsecurity' keyword argument does nothing, and is for compatibilty with the OpenSSL implementation """ return __get_builtin_constructor(name)(data) def __hash_new(name, data=b'', usedforsecurity=True): """new(name, data=b'', usedforsecurity=True) - Return a new hashing object using the named algorithm; optionally initialized with data (which must be bytes). Override 'usedforsecurity' to False when using for non-security purposes in a FIPS environment """ try: return _hashlib.new(name, data, usedforsecurity) except ValueError: # TODO: We want to just raise here when OpenSSL implements sha3 # because we want to make sure that Fedora uses everything from OpenSSL return __get_builtin_constructor(name)(data) try: import _hashlib new = __hash_new __get_hash = __get_openssl_constructor algorithms_available = algorithms_available.union( _hashlib.openssl_md_meth_names) except ImportError: new = __py_new __get_hash = __get_builtin_constructor try: # OpenSSL's PKCS5_PBKDF2_HMAC requires OpenSSL 1.0+ with HMAC and SHA from _hashlib import pbkdf2_hmac except ImportError: _trans_5C = bytes((x ^ 0x5C) for x in range(256)) _trans_36 = bytes((x ^ 0x36) for x in range(256)) def pbkdf2_hmac(hash_name, password, salt, iterations, dklen=None): """Password based key derivation function 2 (PKCS #5 v2.0) This Python implementations based on the hmac module about as fast as OpenSSL's PKCS5_PBKDF2_HMAC for short passwords and much faster for long passwords. """ if not isinstance(hash_name, str): raise TypeError(hash_name) if not isinstance(password, (bytes, bytearray)): password = bytes(memoryview(password)) if not isinstance(salt, (bytes, bytearray)): salt = bytes(memoryview(salt)) # Fast inline HMAC implementation inner = new(hash_name) outer = new(hash_name) blocksize = getattr(inner, 'block_size', 64) if len(password) > blocksize: password = new(hash_name, password).digest() password = password + b'\x00' * (blocksize - len(password)) inner.update(password.translate(_trans_36)) outer.update(password.translate(_trans_5C)) def prf(msg, inner=inner, outer=outer): # PBKDF2_HMAC uses the password as key. We can re-use the same # digest objects and just update copies to skip initialization. icpy = inner.copy() ocpy = outer.copy() icpy.update(msg) ocpy.update(icpy.digest()) return ocpy.digest() if iterations < 1: raise ValueError(iterations) if dklen is None: dklen = outer.digest_size if dklen < 1: raise ValueError(dklen) dkey = b'' loop = 1 from_bytes = int.from_bytes while len(dkey) < dklen: prev = prf(salt + loop.to_bytes(4, 'big')) # endianess doesn't matter here as long to / from use the same rkey = int.from_bytes(prev, 'big') for i in range(iterations - 1): prev = prf(prev) # rkey = rkey ^ prev rkey ^= from_bytes(prev, 'big') loop += 1 dkey += rkey.to_bytes(inner.digest_size, 'big') return dkey[:dklen] for __func_name in __always_supported: # try them all, some may not work due to the OpenSSL # version not supporting that algorithm. try: func = __get_hash(__func_name) if 'sha3_' in __func_name: func = __ignore_usedforsecurity(func) globals()[__func_name] = func except ValueError: import logging logging.exception('code for hash %s was not found.', __func_name) # Cleanup locals() del __always_supported, __func_name, __get_hash del __py_new, __hash_new, __get_openssl_constructor del __ignore_usedforsecurity