Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions fmd5sum/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from .fmd5sum import md5sum, main
from .fmd5sum import md5sum, main, process_files

__all__ = ["md5sum", "main"]
__all__ = ["md5sum", "main", "process_files"]

__version__ = "0.2.0"
__author__ = "Jiale Chen"
Expand Down
6 changes: 5 additions & 1 deletion fmd5sum/fmd5sum.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@

def md5sum(filename, blocksize=65536):
"""Optimized MD5 checksum calculator with low-level file I/O."""
OPEN_FLAGS = os.O_RDONLY
if sys.platform.startswith("win32"):
OPEN_FLAGS |= os.O_BINARY

hash_md5 = hashlib.md5()
try:
fd = os.open(filename, os.O_RDONLY | os.O_BINARY)
fd = os.open(filename, OPEN_FLAGS)
with open(fd, "rb", closefd=True) as f:
while True:
block = f.read(blocksize)
Expand Down
Loading