bronx.system.hash¶
Interface to the Python’s hashlib module that generates hashes on files, strings, …
Classes¶
- class bronx.system.hash.HashAdapter(algorithm)[source]¶
Bases:
objectThis class provides convenient methods to generate and check hash sums on files, File objects or strings.
- Parameters:
algorithm (str) – The name of an available hash algorithm (see the
algorithms()static method)
- property algorithm¶
Hash algorithm in use within this instance.
- file2hash(input_file)[source]¶
Returns a hash string.
- Parameters:
input_file – Path to a file or opened File-like object
- file2hash_fh(input_file)[source]¶
Returns a File-like object that contains a hash string
- Parameters:
input_file – Path to a file or opened File-like object
- file2hash_file(input_file, output_file)[source]¶
Create a plain file that contains a hash string
- Parameters:
input_file – Path to a file or opened File-like object
output_file – Path to the output file