We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0cbf493 commit be10ce4Copy full SHA for be10ce4
webArchiver.py
@@ -95,22 +95,10 @@ def forcedir(file_path):
95
96
97
def hasher(filein, hname, blocksize):
98
- htype = {
99
- "blake2s": lambda: hashlib.blake2s(),
100
- "sha384": lambda: hashlib.sha384(),
101
- "sha512": lambda: hashlib.sha512(),
102
- "sha3_256": lambda: hashlib.sha3_256(),
103
- "sha256": lambda: hashlib.sha256(),
104
- "md5": lambda: hashlib.md5(),
105
- "sha3_512": lambda: hashlib.sha3_512(),
106
- "sha3_224": lambda: hashlib.sha3_224(),
107
- "shake_128": lambda: hashlib.shake_128(),
108
- "shake_256": lambda: hashlib.shake_256(),
109
- "sha1": lambda: hashlib.sha1(),
110
- "blake2b": lambda: hashlib.blake2b(),
111
- "sha224": lambda: hashlib.sha224(),
112
- "sha3_384": lambda: hashlib.sha3_384(),
113
- }.get(hname, lambda: (print("wrong hash type"), exit(1)))()
+ htype = getattr(hashlib, hname, print)()
+ if htype is None:
+ print("wrong hash type")
+ exit(1)
114
with open(filein, 'rb') as fi:
115
while True:
116
data = fi.read(blocksize)
0 commit comments