Set usedforsecurity=False in hashlib methods (FIPS compliance) (#27483)

* Set usedforsecurity=False in hashlib methods (FIPS compliance)

* trigger ci

* tokenizers version

* deps

* bump hfh version

* let's try this
This commit is contained in:
Lucain
2023-11-16 15:29:53 +01:00
committed by GitHub
parent 5603fad247
commit fd65aa9818
9 changed files with 21 additions and 19 deletions

View File

@@ -12,9 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import hashlib
import unittest
from huggingface_hub.utils import insecure_hashlib
from transformers import MODEL_FOR_DEPTH_ESTIMATION_MAPPING, is_torch_available, is_vision_available
from transformers.pipelines import DepthEstimationPipeline, pipeline
from transformers.testing_utils import (
@@ -44,7 +45,7 @@ else:
def hashimage(image: Image) -> str:
m = hashlib.md5(image.tobytes())
m = insecure_hashlib.md5(image.tobytes())
return m.hexdigest()

View File

@@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import hashlib
import tempfile
import unittest
from typing import Dict
@@ -21,6 +20,7 @@ import datasets
import numpy as np
import requests
from datasets import load_dataset
from huggingface_hub.utils import insecure_hashlib
from transformers import (
MODEL_FOR_IMAGE_SEGMENTATION_MAPPING,
@@ -59,7 +59,7 @@ else:
def hashimage(image: Image) -> str:
m = hashlib.md5(image.tobytes())
m = insecure_hashlib.md5(image.tobytes())
return m.hexdigest()[:10]

View File

@@ -12,11 +12,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import hashlib
import unittest
from typing import Dict
import numpy as np
from huggingface_hub.utils import insecure_hashlib
from transformers import (
MODEL_FOR_MASK_GENERATION_MAPPING,
@@ -46,7 +46,7 @@ else:
def hashimage(image: Image) -> str:
m = hashlib.md5(image.tobytes())
m = insecure_hashlib.md5(image.tobytes())
return m.hexdigest()[:10]