john-kurkowski / tldextract

Accurately separates a URL’s subdomain, domain, and public suffix, using the Public Suffix List (PSL).
BSD 3-Clause "New" or "Revised" License
1.81k stars 211 forks source link

TLDExtract is not compatible with FIPS-enabled crypto libraries #308

Closed CharlesB2 closed 8 months ago

CharlesB2 commented 8 months ago

Using FIPS-enabled libraries I get the following error on importing tldextract:

 File "/home/nonroot/.my-venv/lib/python3.10/site-packages/tldextract/__init__.py", line 4, in <module>
    from .tldextract import TLDExtract, extract
  File "/home/nonroot/.my-venv/lib/python3.10/site-packages/tldextract/tldextract.py", line 148, in <module>
    class TLDExtract:
  File "/home/nonroot/.my-venv/lib/python3.10/site-packages/tldextract/tldextract.py", line 154, in TLDExtract
    cache_dir: str | None = get_cache_dir(),
  File "/home/nonroot/.my-venv/lib/python3.10/site-packages/tldextract/cache.py", line 74, in get_cache_dir
    xdg_cache_home, "python-tldextract", get_pkg_unique_identifier()
  File "/home/nonroot/.my-venv/lib/python3.10/site-packages/tldextract/cache.py", line 42, in get_pkg_unique_identifier
    python_binary_path_short_hash = md5(sys.prefix.encode("utf-8")).hexdigest()[:6]
ValueError: [digital envelope routines] unsupported

See https://docs.python.org/3/library/hashlib.html non-cryptographic hash functions must use usedforsecurity=False