Python module and command-line tool that wraps around `hashlib` and `zlib` to facilitate generating checksums/hashes of files and directories. It supports various algorithms like MD5, SHA-*, Adler-32, and CRC32, handling large files efficiently by processing them in chunks. The current version is 0.2.dev1 and it appears to be in active development based on the versioning.
pip install filehashVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize the `FileHash` class and calculate the hash of a single file using different algorithms like SHA256 and MD5. It creates a temporary file for a runnable example and cleans it up afterwards. The `FileHash` constructor also accepts an optional `chunk_size` parameter for fine-tuning performance with very large files.
Prefer stronger cryptographic hash algorithms like SHA-256, SHA-512, or BLAKE2* for integrity checks in security-sensitive contexts.
Ensure your Python environment is 3.6 or newer when utilizing BLAKE2* algorithms. Otherwise, select a different hash algorithm compatible with your Python version.
Adjust `chunk_size` in `FileHash(chunk_size=desired_bytes)` for optimized performance or memory usage, especially with multi-gigabyte files.
Install the package using pip: `pip install filehash`
Ensure you are passing the correct type of object. If the function expects an open file, pass `open('your_file.txt', 'rb')`; if it expects a path, pass the string directly. Consult the 'filehash' library's documentation for the specific function's argument type.Verify that the file path provided to the 'filehash' function is correct and that the file exists at that location.
Use one of the supported algorithms such as 'md5', 'sha1', 'sha256', 'sha512', 'adler32', or 'crc32'. Consult the 'filehash' documentation for the full list of supported algorithms.
No dependency data recorded yet.