2022-01-07 23:12:15 -05:00
|
|
|
import hashlib
|
2022-01-08 18:24:29 -05:00
|
|
|
import pathlib
|
|
|
|
import sys
|
2022-01-07 23:12:15 -05:00
|
|
|
|
2022-01-08 18:24:29 -05:00
|
|
|
packages_dir = pathlib.Path(sys.argv[1]).resolve().absolute()
|
2022-01-07 23:12:15 -05:00
|
|
|
|
2022-01-07 23:26:32 -05:00
|
|
|
print("Showing hash values of files to be uploaded:")
|
|
|
|
|
2022-01-08 18:25:56 -05:00
|
|
|
for file_object in packages_dir.iterdir():
|
2022-01-09 02:18:25 -05:00
|
|
|
sha256 = hashlib.sha256()
|
|
|
|
md5 = hashlib.md5()
|
|
|
|
blake2_256 = hashlib.blake2b(digest_size=256 // 8)
|
2022-01-09 06:53:19 -05:00
|
|
|
|
2022-01-08 18:24:29 -05:00
|
|
|
print(file_object)
|
2022-01-07 23:12:15 -05:00
|
|
|
print("")
|
|
|
|
|
2022-01-08 18:24:29 -05:00
|
|
|
content = file_object.read_bytes()
|
2022-01-09 06:53:19 -05:00
|
|
|
|
2022-01-07 23:12:15 -05:00
|
|
|
sha256.update(content)
|
|
|
|
md5.update(content)
|
|
|
|
blake2_256.update(content)
|
|
|
|
|
|
|
|
print(f"SHA256: {sha256.hexdigest()}")
|
|
|
|
print(f"MD5: {md5.hexdigest()}")
|
|
|
|
print(f"BLAKE2-256: {blake2_256.hexdigest()}")
|
|
|
|
print("")
|