Skip to content

Commit 0168c3b

Browse files
authored
Merge pull request #440 from xlian-nextgen/master
Addresed FIPS compliance issues
2 parents 93802ff + b2c2c35 commit 0168c3b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

cfgrib/messages.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -531,8 +531,11 @@ def from_indexpath_or_filestream(
531531
# Reading and writing the index can be explicitly suppressed by passing indexpath==''.
532532
if not indexpath:
533533
return cls.from_fieldset(filestream, index_keys, computed_keys)
534-
535-
hash = hashlib.md5(repr(index_keys).encode("utf-8")).hexdigest()
534+
repr_index_keys = repr(index_keys).encode("utf-8")
535+
try:
536+
hash = hashlib.md5(repr_index_keys, usedforsecurity=False).hexdigest()
537+
except TypeError:
538+
hash = hashlib.md5(repr_index_keys).hexdigest()
536539
indexpath = indexpath.format(path=filestream.path, hash=hash, short_hash=hash[:5])
537540
try:
538541
with compat_create_exclusive(indexpath) as new_index_file:

0 commit comments

Comments
 (0)