From 8cc841066986fbfc328cdcac17e03bffc8b9265a Mon Sep 17 00:00:00 2001 From: Michele Dolfi Date: Fri, 2 May 2025 14:21:36 +0200 Subject: [PATCH] fix usage of hashlib for FIPS Signed-off-by: Michele Dolfi --- docling_core/types/doc/document.py | 2 +- docling_core/utils/legacy.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docling_core/types/doc/document.py b/docling_core/types/doc/document.py index e47e4a44..0fb08f04 100644 --- a/docling_core/types/doc/document.py +++ b/docling_core/types/doc/document.py @@ -1073,7 +1073,7 @@ def _image_to_hexhash(self) -> Optional[str]: image_bytes = self.image._pil.tobytes() # Create a hash object (e.g., SHA-256) - hasher = hashlib.sha256() + hasher = hashlib.sha256(usedforsecurity=False) # Feed the image bytes into the hash object hasher.update(image_bytes) diff --git a/docling_core/utils/legacy.py b/docling_core/utils/legacy.py index 74f91867..1ff424d5 100644 --- a/docling_core/utils/legacy.py +++ b/docling_core/utils/legacy.py @@ -47,7 +47,7 @@ def _create_hash(string: str): - hasher = hashlib.sha256() + hasher = hashlib.sha256(usedforsecurity=False) hasher.update(string.encode("utf-8")) return hasher.hexdigest()