/
snap
/
core24
/
1587
/
usr
/
lib
/
python3.12
/
/snap/core24/1587/usr/lib/python3.12
mkdir
upload
Name
Size
Mode
Actions
asyncio/
-
0755
rm
collections/
-
0755
rm
concurrent/
-
0755
rm
ctypes/
-
0755
rm
curses/
-
0755
rm
dbm/
-
0755
rm
email/
-
0755
rm
encodings/
-
0755
rm
html/
-
0755
rm
http/
-
0755
rm
importlib/
-
0755
rm
json/
-
0755
rm
lib-dynload/
-
0755
rm
logging/
-
0755
rm
multiprocessing/
-
0755
rm
pydoc_data/
-
0755
rm
re/
-
0755
rm
sqlite3/
-
0755
rm
test/
-
0755
rm
tomllib/
-
0755
rm
unittest/
-
0755
rm
urllib/
-
0755
rm
venv/
-
0755
rm
wsgiref/
-
0755
rm
xml/
-
0755
rm
xmlrpc/
-
0755
rm
zipfile/
-
0755
rm
zoneinfo/
-
0755
rm
__phello__/
-
0755
rm
__pycache__/
-
0755
rm
abc.py
6538
0644
edit
dl
rm
aifc.py
34211
0644
edit
dl
rm
antigravity.py
500
0644
edit
dl
rm
argparse.py
101750
0644
edit
dl
rm
ast.py
64260
0644
edit
dl
rm
base64.py
20602
0755
edit
dl
rm
bdb.py
32463
0644
edit
dl
rm
bisect.py
3423
0644
edit
dl
rm
bz2.py
11847
0644
edit
dl
rm
calendar.py
25418
0644
edit
dl
rm
cgi.py
34418
0755
edit
dl
rm
cgitb.py
12421
0644
edit
dl
rm
chunk.py
5500
0644
edit
dl
rm
cmd.py
14873
0644
edit
dl
rm
code.py
10695
0644
edit
dl
rm
codecs.py
36870
0644
edit
dl
rm
codeop.py
5908
0644
edit
dl
rm
colorsys.py
4062
0644
edit
dl
rm
compileall.py
20598
0644
edit
dl
rm
configparser.py
53789
0644
edit
dl
rm
contextlib.py
27637
0644
edit
dl
rm
contextvars.py
129
0644
edit
dl
rm
copy.py
8412
0644
edit
dl
rm
copyreg.py
7614
0644
edit
dl
rm
cProfile.py
6555
0755
edit
dl
rm
crypt.py
3913
0644
edit
dl
rm
csv.py
16386
0644
edit
dl
rm
dataclasses.py
61753
0644
edit
dl
rm
datetime.py
268
0644
edit
dl
rm
decimal.py
320
0644
edit
dl
rm
difflib.py
83308
0644
edit
dl
rm
dis.py
30209
0644
edit
dl
rm
doctest.py
106479
0644
edit
dl
rm
enum.py
81636
0644
edit
dl
rm
EXTERNALLY-MANAGED
645
0644
edit
dl
rm
filecmp.py
10187
0644
edit
dl
rm
fileinput.py
15714
0644
edit
dl
rm
fnmatch.py
5999
0644
edit
dl
rm
fractions.py
38067
0644
edit
dl
rm
ftplib.py
34735
0644
edit
dl
rm
functools.py
38126
0644
edit
dl
rm
genericpath.py
5572
0644
edit
dl
rm
getopt.py
7488
0644
edit
dl
rm
getpass.py
5990
0644
edit
dl
rm
gettext.py
21747
0644
edit
dl
rm
glob.py
8732
0644
edit
dl
rm
graphlib.py
9656
0644
edit
dl
rm
gzip.py
24859
0644
edit
dl
rm
hashlib.py
9349
0644
edit
dl
rm
heapq.py
23024
0644
edit
dl
rm
hmac.py
7716
0644
edit
dl
rm
imaplib.py
53688
0644
edit
dl
rm
imghdr.py
4398
0644
edit
dl
rm
inspect.py
125420
0644
edit
dl
rm
io.py
3582
0644
edit
dl
rm
ipaddress.py
78294
0644
edit
dl
rm
keyword.py
1073
0644
edit
dl
rm
LICENSE.txt
13936
0644
edit
dl
rm
linecache.py
5649
0644
edit
dl
rm
locale.py
78562
0644
edit
dl
rm
lzma.py
13277
0644
edit
dl
rm
mailbox.py
78911
0644
edit
dl
rm
mailcap.py
9333
0644
edit
dl
rm
mimetypes.py
22888
0644
edit
dl
rm
modulefinder.py
23699
0644
edit
dl
rm
netrc.py
6922
0644
edit
dl
rm
nntplib.py
41087
0644
edit
dl
rm
ntpath.py
30027
0644
edit
dl
rm
nturl2path.py
2887
0644
edit
dl
rm
numbers.py
11467
0644
edit
dl
rm
opcode.py
13174
0644
edit
dl
rm
operator.py
10965
0644
edit
dl
rm
optparse.py
60369
0644
edit
dl
rm
os.py
39786
0644
edit
dl
rm
pathlib.py
51153
0644
edit
dl
rm
pdb.py
69459
0755
edit
dl
rm
pickle.py
64901
0644
edit
dl
rm
pickletools.py
93861
0644
edit
dl
rm
pipes.py
8978
0644
edit
dl
rm
pkgutil.py
18281
0644
edit
dl
rm
platform.py
43331
0755
edit
dl
rm
plistlib.py
28582
0644
edit
dl
rm
poplib.py
14163
0644
edit
dl
rm
posixpath.py
17623
0644
edit
dl
rm
pprint.py
24158
0644
edit
dl
rm
profile.py
23092
0755
edit
dl
rm
pstats.py
29289
0644
edit
dl
rm
pty.py
6137
0644
edit
dl
rm
pyclbr.py
11396
0644
edit
dl
rm
pydoc.py
113090
0755
edit
dl
rm
py_compile.py
7878
0644
edit
dl
rm
queue.py
11496
0644
edit
dl
rm
quopri.py
7183
0755
edit
dl
rm
random.py
34683
0644
edit
dl
rm
reprlib.py
6569
0644
edit
dl
rm
rlcompleter.py
7827
0644
edit
dl
rm
runpy.py
12898
0644
edit
dl
rm
sched.py
6351
0644
edit
dl
rm
secrets.py
1984
0644
edit
dl
rm
selectors.py
19671
0644
edit
dl
rm
shelve.py
8560
0644
edit
dl
rm
shlex.py
13353
0644
edit
dl
rm
shutil.py
58120
0644
edit
dl
rm
signal.py
2495
0644
edit
dl
rm
site.py
23903
0644
edit
dl
rm
sitecustomize.py
-
0
edit
dl
rm
smtplib.py
43531
0755
edit
dl
rm
sndhdr.py
7448
0644
edit
dl
rm
socket.py
37411
0644
edit
dl
rm
socketserver.py
27851
0644
edit
dl
rm
sre_compile.py
231
0644
edit
dl
rm
sre_constants.py
232
0644
edit
dl
rm
sre_parse.py
229
0644
edit
dl
rm
ssl.py
50822
0644
edit
dl
rm
stat.py
5485
0644
edit
dl
rm
statistics.py
50227
0644
edit
dl
rm
string.py
11786
0644
edit
dl
rm
stringprep.py
12917
0644
edit
dl
rm
struct.py
257
0644
edit
dl
rm
subprocess.py
88725
0644
edit
dl
rm
sunau.py
18478
0644
edit
dl
rm
symtable.py
10753
0644
edit
dl
rm
sysconfig.py
32768
0644
edit
dl
rm
tabnanny.py
11530
0755
edit
dl
rm
tarfile.py
112555
0755
edit
dl
rm
telnetlib.py
23301
0644
edit
dl
rm
tempfile.py
37334
0644
edit
dl
rm
textwrap.py
19718
0644
edit
dl
rm
this.py
1003
0644
edit
dl
rm
threading.py
60123
0644
edit
dl
rm
timeit.py
13463
0755
edit
dl
rm
token.py
2479
0644
edit
dl
rm
tokenize.py
21214
0644
edit
dl
rm
trace.py
29182
0755
edit
dl
rm
traceback.py
46325
0644
edit
dl
rm
tracemalloc.py
18047
0644
edit
dl
rm
tty.py
2035
0644
edit
dl
rm
turtle.py
146361
0644
edit
dl
rm
types.py
10993
0644
edit
dl
rm
typing.py
117428
0644
edit
dl
rm
uu.py
7364
0755
edit
dl
rm
uuid.py
29656
0644
edit
dl
rm
warnings.py
21760
0644
edit
dl
rm
wave.py
22769
0644
edit
dl
rm
weakref.py
21513
0644
edit
dl
rm
webbrowser.py
23627
0755
edit
dl
rm
xdrlib.py
5942
0644
edit
dl
rm
zipapp.py
7543
0644
edit
dl
rm
zipimport.py
28132
0644
edit
dl
rm
_aix_support.py
4021
0644
edit
dl
rm
_collections_abc.py
32082
0644
edit
dl
rm
_compat_pickle.py
8761
0644
edit
dl
rm
_compression.py
5681
0644
edit
dl
rm
_distutils_system_mod.py
5716
0644
edit
dl
rm
_markupbase.py
14653
0644
edit
dl
rm
_osx_support.py
22023
0644
edit
dl
rm
_pydatetime.py
92097
0644
edit
dl
rm
_pydecimal.py
229220
0644
edit
dl
rm
_pyio.py
93593
0644
edit
dl
rm
_pylong.py
9047
0644
edit
dl
rm
_py_abc.py
6189
0644
edit
dl
rm
_sitebuiltins.py
3128
0644
edit
dl
rm
_strptime.py
24615
0644
edit
dl
rm
_sysconfigdata__linux_x86_64-linux-gnu.py
49505
0644
edit
dl
rm
_sysconfigdata__x86_64-linux-gnu.py
49505
0644
edit
dl
rm
_threading_local.py
7220
0644
edit
dl
rm
_weakrefset.py
5893
0644
edit
dl
rm
__future__.py
5218
0644
edit
dl
rm
__hello__.py
227
0644
edit
dl
rm
Edit:
/snap/core24/1587/usr/lib/python3.12/hashlib.py
(9349B)
#. 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'', **kwargs) - 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(), sha512(), blake2b(), blake2s(), sha3_224, sha3_256, sha3_384, sha3_512, shake_128, and shake_256. 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. Hash objects have these methods: - update(data): Update the hash object with the bytes in data. 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 as a bytes object. - hexdigest(): Like digest() except the digest is returned as a string 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 datas that share a common initial substring. For example, to obtain the digest of the byte 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', 'blake2b', 'blake2s', 'sha3_224', 'sha3_256', 'sha3_384', 'sha3_512', 'shake_128', 'shake_256') algorithms_guaranteed = set(__always_supported) algorithms_available = set(__always_supported) __all__ = __always_supported + ('new', 'algorithms_guaranteed', 'algorithms_available', 'file_digest') __builtin_constructor_cache = {} # Prefer our blake2 implementation # OpenSSL 1.1.0 comes with a limited implementation of blake2b/s. The OpenSSL # implementations neither support keyed blake2 (blake2 MAC) nor advanced # features like salt, personalization, or tree hashing. OpenSSL hash-only # variants are available as 'blake2b512' and 'blake2s256', though. __block_openssl_constructor = { 'blake2b', 'blake2s', } 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 _sha2 cache['SHA224'] = cache['sha224'] = _sha2.sha224 cache['SHA256'] = cache['sha256'] = _sha2.sha256 elif name in {'SHA512', 'sha512', 'SHA384', 'sha384'}: import _sha2 cache['SHA384'] = cache['sha384'] = _sha2.sha384 cache['SHA512'] = cache['sha512'] = _sha2.sha512 elif name in {'blake2b', 'blake2s'}: import _blake2 cache['blake2b'] = _blake2.blake2b cache['blake2s'] = _blake2.blake2s elif name in {'sha3_224', 'sha3_256', 'sha3_384', 'sha3_512'}: import _sha3 cache['sha3_224'] = _sha3.sha3_224 cache['sha3_256'] = _sha3.sha3_256 cache['sha3_384'] = _sha3.sha3_384 cache['sha3_512'] = _sha3.sha3_512 elif name in {'shake_128', 'shake_256'}: import _sha3 cache['shake_128'] = _sha3.shake_128 cache['shake_256'] = _sha3.shake_256 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): if name in __block_openssl_constructor: # Prefer our builtin blake2 implementation. return __get_builtin_constructor(name) try: # MD5, SHA1, and SHA2 are in all supported OpenSSL versions # SHA3/shake are available in OpenSSL 1.1.1+ f = getattr(_hashlib, 'openssl_' + name) # Allow the C module to raise ValueError. The function will be # defined but the hash not actually available. Don't fall back to # builtin if the current security policy blocks a digest, bpo#40695. f(usedforsecurity=False) # Use the C function directly (very fast) return f except (AttributeError, ValueError): return __get_builtin_constructor(name) def __py_new(name, data=b'', **kwargs): """new(name, data=b'', **kwargs) - Return a new hashing object using the named algorithm; optionally initialized with data (which must be a bytes-like object). """ return __get_builtin_constructor(name)(data, **kwargs) def __hash_new(name, data=b'', **kwargs): """new(name, data=b'') - Return a new hashing object using the named algorithm; optionally initialized with data (which must be a bytes-like object). """ if name in __block_openssl_constructor: # Prefer our builtin blake2 implementation. return __get_builtin_constructor(name)(data, **kwargs) try: return _hashlib.new(name, data, **kwargs) except ValueError: # If the _hashlib module (OpenSSL) doesn't support the named # hash, try using our builtin implementations. # This allows for SHA224/256 and SHA384/512 support even though # the OpenSSL library prior to 0.9.8 doesn't provide them. 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: _hashlib = None 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 __all__ += ('pbkdf2_hmac',) except ImportError: pass try: # OpenSSL's scrypt requires OpenSSL 1.1+ from _hashlib import scrypt except ImportError: pass def file_digest(fileobj, digest, /, *, _bufsize=2**18): """Hash the contents of a file-like object. Returns a digest object. *fileobj* must be a file-like object opened for reading in binary mode. It accepts file objects from open(), io.BytesIO(), and SocketIO objects. The function may bypass Python's I/O and use the file descriptor *fileno* directly. *digest* must either be a hash algorithm name as a *str*, a hash constructor, or a callable that returns a hash object. """ # On Linux we could use AF_ALG sockets and sendfile() to archive zero-copy # hashing with hardware acceleration. if isinstance(digest, str): digestobj = new(digest) else: digestobj = digest() if hasattr(fileobj, "getbuffer"): # io.BytesIO object, use zero-copy buffer digestobj.update(fileobj.getbuffer()) return digestobj # Only binary files implement readinto(). if not ( hasattr(fileobj, "readinto") and hasattr(fileobj, "readable") and fileobj.readable() ): raise ValueError( f"'{fileobj!r}' is not a file-like object in binary reading mode." ) # binary file, socket.SocketIO object # Note: socket I/O uses different syscalls than file I/O. buf = bytearray(_bufsize) # Reusable buffer to reduce allocations. view = memoryview(buf) while True: size = fileobj.readinto(buf) if size == 0: break # EOF digestobj.update(view[:size]) return digestobj for __func_name in __always_supported: # try them all, some may not work due to the OpenSSL # version not supporting that algorithm. try: globals()[__func_name] = __get_hash(__func_name) 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
Save
cmd:
run