diff --git a/docling/document_converter.py b/docling/document_converter.py index 125681f..08095d4 100644 --- a/docling/document_converter.py +++ b/docling/document_converter.py @@ -189,7 +189,9 @@ class DocumentConverter: def _get_pipeline_options_hash(self, pipeline_options: PipelineOptions) -> str: """Generate a hash of pipeline options to use as part of the cache key.""" options_str = str(pipeline_options.model_dump()) - return hashlib.md5(options_str.encode("utf-8")).hexdigest() + return hashlib.md5( + options_str.encode("utf-8"), usedforsecurity=False + ).hexdigest() def initialize_pipeline(self, format: InputFormat): """Initialize the conversion pipeline for the selected format.""" diff --git a/docling/utils/utils.py b/docling/utils/utils.py index 11b9fdd..6425820 100644 --- a/docling/utils/utils.py +++ b/docling/utils/utils.py @@ -20,7 +20,7 @@ def create_file_hash(path_or_stream: Union[BytesIO, Path]) -> str: """Create a stable page_hash of the path_or_stream of a file""" block_size = 65536 - hasher = hashlib.sha256() + hasher = hashlib.sha256(usedforsecurity=False) def _hash_buf(binary_stream): buf = binary_stream.read(block_size) # read and page_hash in chunks @@ -38,7 +38,7 @@ def create_file_hash(path_or_stream: Union[BytesIO, Path]) -> str: def create_hash(string: str): - hasher = hashlib.sha256() + hasher = hashlib.sha256(usedforsecurity=False) hasher.update(string.encode("utf-8")) return hasher.hexdigest()