Skip to content

Commit cf2d77a

Browse files
authored
Merge pull request numpy#27104 from tiran/genapi-fips-md5
Fix building NumPy in FIPS mode
2 parents 972c16d + 818515b commit cf2d77a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

numpy/_core/code_generators/genapi.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ def __str__(self):
160160
return '%s%s %s(%s)' % (doccomment, self.return_type, self.name, argstr)
161161

162162
def api_hash(self):
163-
m = hashlib.md5()
163+
m = hashlib.md5(usedforsecurity=False)
164164
m.update(remove_whitespace(self.return_type))
165165
m.update('\000')
166166
m.update(self.name)
@@ -533,7 +533,9 @@ def fullapi_hash(api_dicts):
533533
a.extend(name)
534534
a.extend(','.join(map(str, data)))
535535

536-
return hashlib.md5(''.join(a).encode('ascii')).hexdigest()
536+
return hashlib.md5(
537+
''.join(a).encode('ascii'), usedforsecurity=False
538+
).hexdigest()
537539

538540
# To parse strings like 'hex = checksum' where hex is e.g. 0x1234567F and
539541
# checksum a 128 bits md5 checksum (hex format as well)
@@ -555,7 +557,7 @@ def main():
555557
tagname = sys.argv[1]
556558
order_file = sys.argv[2]
557559
functions = get_api_functions(tagname, order_file)
558-
m = hashlib.md5(tagname)
560+
m = hashlib.md5(tagname, usedforsecurity=False)
559561
for func in functions:
560562
print(func)
561563
ah = func.api_hash()

0 commit comments

Comments
 (0)