Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1import hashlib
2from pathlib import Path
3
4
5def md5sum(path: str) -> str:
6 """
7 Calculate the MD5 hash of a file as a hex digest
8 :param path:
9 :return:
10 """
11 p = Path(path)
12 assert p.is_file()
13
14 return hashlib.md5(p.read_bytes()).hexdigest()