1
2
3
4 """hashlib that handles FIPS mode."""
5
6
7
8
9 from hashlib import *
10
11 import hashlib
12
13
15 """Make hash function support FIPS mode."""
16 try:
17 return func(*args, **kwargs)
18 except ValueError:
19 return func(*args, usedforsecurity=False, **kwargs)
20
21
22
23
24 -def md5(*args, **kwargs):
25 """MD5 constructor that works in FIPS mode."""
26 return _fipsFunction(hashlib.md5, *args, **kwargs)
27
28
29 -def new(*args, **kwargs):
30 """General constructor that works in FIPS mode."""
31 return _fipsFunction(hashlib.new, *args, **kwargs)
32
33