fix: usage of hashlib for FIPS (#1512)
fix usage of hashlib for FIPS Signed-off-by: Michele Dolfi <dol@zurich.ibm.com>
This commit is contained in:
parent
de56523974
commit
7c705739f9
@ -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."""
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user