Repository: pytest-dev/pytest-randomly (language: python)

Issue:
hashlib.md5 doesn't work when FIPS is enabled
### Python Version

3.9.9

### pytest Version

6.2.5

### Package Version

3.10.2

### Description

On a system where FIPS is enabled, pytest-randomly fails on line 275 
```python
hasher = hashlib.md5()
```
with the following error
```text
ValueError: [digital envelope routines: EVP_DigestInit_ex] disabled for FIPS
```

This appears to be common among tools that use `hashlib`.  The following workaround seems to fix the problem, edit `pytest_randomly/__init__.py` line 275 to be:
```python
hasher = hashlib.md5(usedforsecurity=False)
```

I found this idea for a fix here:  https://github.com/s3tools/s3cmd/issues/1005#issuecomment-578241131.  This issue was related to another package using `hashlib.md5`
 


Discussion / hints:
Note that `usedforsecurity` was introduced in 3.9: https://docs.python.org/3/library/hashlib.html#hash-algorithms

Some kind of conditional will be needed to support older versions of Python.

https://github.com/pytest-dev/pytest-randomly/blob/fbb03b718e74fb78baebd936f94298ee17e2449c/.github/workflows/main.yml#L16-L21

Fix patch:
diff --git a/HISTORY.rst b/HISTORY.rst
index f9787bc..549fab2 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -2,6 +2,10 @@
 History
 =======
 
+* Work on FIPS Python 3.9+, by declaring use of ``hashlib.md5()`` as not used for security.
+
+  Thanks to dantebben for the report in `Issue #414 <https://github.com/pytest-dev/pytest-randomly/issues/414>`__.
+
 3.10.2 (2021-11-10)
 -------------------
 


Test patch:
diff --git a/src/pytest_randomly/__init__.py b/src/pytest_randomly/__init__.py
index ec51014..32cdac6 100644
--- a/src/pytest_randomly/__init__.py
+++ b/src/pytest_randomly/__init__.py
@@ -11,6 +11,8 @@
 from _pytest.nodes import Item
 from pytest import Collector, fixture, hookimpl
 
+from pytest_randomly.compat import md5
+
 if sys.version_info < (3, 10):
     from importlib_metadata import entry_points
 else:
@@ -274,7 +276,7 @@ def reduce_list_of_lists(lists: List[List[T]]) -> List[T]:
 
 
 def _md5(string: str) -> bytes:
-    hasher = hashlib.md5()
+    hasher = md5()
     hasher.update(string.encode())
     return hasher.digest()
 
diff --git a/src/pytest_randomly/compat.py b/src/pytest_randomly/compat.py
new file mode 100644
index 0000000..27dcb59
--- /dev/null
+++ b/src/pytest_randomly/compat.py
@@ -0,0 +1,8 @@
+import hashlib
+import sys
+from functools import partial
+
+if sys.version_info >= (3, 9):
+    md5 = partial(hashlib.md5, usedforsecurity=False)
+else:
+    md5 = hashlib.md5