mirror of
https://github.com/DS4SD/docling.git
synced 2025-12-12 06:38:10 +00:00
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:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user