This class provides hashlib-based file hasher.
More...
This class provides hashlib-based file hasher.
Definition at line 32 of file file_hashing.py.
◆ __init__()
def caellion.pycommons.hashing.file_hashing.FileHasher.__init__ |
( |
|
self, |
|
|
|
algo = None |
|
) |
| |
Initializes hasher.
Currently supported hashes: SHA1, SHA256, SHA384, SHA512, MD5 (not recommended)
- Parameters
-
algo | String with name of algorithm to use |
- Exceptions
-
Definition at line 46 of file file_hashing.py.
◆ get_hashbytes()
def caellion.pycommons.hashing.file_hashing.FileHasher.get_hashbytes |
( |
|
self | ) |
|
Returns hexadecimal value of hash from this object.
- Returns
- bytes of hash
- Exceptions
-
Definition at line 119 of file file_hashing.py.
◆ get_hexdigest()
def caellion.pycommons.hashing.file_hashing.FileHasher.get_hexdigest |
( |
|
self | ) |
|
Returns hexadecimal value of hash from this object.
- Returns
- hexadecimal string representation of hash
- Exceptions
-
Definition at line 106 of file file_hashing.py.
◆ hash_file()
def caellion.pycommons.hashing.file_hashing.FileHasher.hash_file |
( |
|
self, |
|
|
|
file |
|
) |
| |
Hashes file-object with currently chosen algorithm.
- Parameters
-
file | file-object to be hashed |
- Exceptions
-
Definition at line 69 of file file_hashing.py.
◆ hash_file_and_get_hashbytes()
def caellion.pycommons.hashing.file_hashing.FileHasher.hash_file_and_get_hashbytes |
( |
|
self, |
|
|
|
file |
|
) |
| |
Hashes a file-object and returns hash.
- Parameters
-
file | file-object to be hashed |
- Returns
- bytes of hash
- Exceptions
-
Definition at line 132 of file file_hashing.py.
◆ hash_file_and_get_hexdigest()
def caellion.pycommons.hashing.file_hashing.FileHasher.hash_file_and_get_hexdigest |
( |
|
self, |
|
|
|
file |
|
) |
| |
Hashes a file-object and returns hash.
- Parameters
-
file | file-object to be hashed |
- Returns
- hexadecimal string representation of hash
- Exceptions
-
Definition at line 158 of file file_hashing.py.
◆ hash_path()
def caellion.pycommons.hashing.file_hashing.FileHasher.hash_path |
( |
|
self, |
|
|
|
path |
|
) |
| |
Hashes file-object with currently chosen algorithm.
- Parameters
-
path | path to file to be hashed |
- Exceptions
-
Definition at line 87 of file file_hashing.py.
◆ hash_path_and_get_hashbytes()
def caellion.pycommons.hashing.file_hashing.FileHasher.hash_path_and_get_hashbytes |
( |
|
self, |
|
|
|
path |
|
) |
| |
Hashes a file at path and returns hash.
- Parameters
-
path | path to the file to be hashed |
- Returns
- bytes of hash
- Exceptions
-
Definition at line 145 of file file_hashing.py.
◆ hash_path_and_get_hexdigest()
def caellion.pycommons.hashing.file_hashing.FileHasher.hash_path_and_get_hexdigest |
( |
|
self, |
|
|
|
path |
|
) |
| |
Hashes a file at path and returns hash.
- Parameters
-
path | path to the file to be hashed |
- Returns
- hexadecimal string representation of hash
- Exceptions
-
Definition at line 171 of file file_hashing.py.
◆ digest
caellion.pycommons.hashing.file_hashing.FileHasher.digest = None |
|
static |
◆ hashlib_instance
caellion.pycommons.hashing.file_hashing.FileHasher.hashlib_instance = None |
|
static |
Instance of hashlib algorithm implementation.
Definition at line 38 of file file_hashing.py.
◆ hexdigest
caellion.pycommons.hashing.file_hashing.FileHasher.hexdigest = None |
|
static |
◆ islocked [1/2]
bool caellion.pycommons.hashing.file_hashing.FileHasher.islocked = False |
|
static |
◆ islocked [2/2]
caellion.pycommons.hashing.file_hashing.FileHasher.islocked |
The documentation for this class was generated from the following file: