You need to sign in or sign up before continuing.
Commit 3dde62be authored by Max Kellermann's avatar Max Kellermann

python/build/verify: move code to file_digest()

parent 8bfabbe2
......@@ -16,9 +16,14 @@ def feed_file_path(h, path):
with open(path, 'rb') as f:
feed_file(h, f)
def file_md5(path):
"""Calculate the MD5 checksum of a file and return it in hexadecimal notation."""
def file_digest(algorithm, path):
"""Calculate the digest of a file and return it in hexadecimal notation."""
h = hashlib.md5()
h = algorithm()
feed_file_path(h, path)
return h.hexdigest()
def file_md5(path):
"""Calculate the MD5 checksum of a file and return it in hexadecimal notation."""
return file_digest(hashlib.md5, path)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment