Skip to content

Use of md5 hash causes FIPS error, requires usedforsecurity=False #2270

@darugar

Description

@darugar

Use of the md5 hashing algorithm is not permitted in FIPS systems, exhibiting the error:

else hashlib.md5(name.encode("utf8")).hexdigest()[:6],
ValueError: [digital envelope routines] unsupported

This can be fixed via hashlib.md5(usedforsecurity=False):

in database.py:

return hashlib.md5(self.name.encode("utf8"), usedforsecurity=False).hexdigest()[:6]

in init.py:

    md5_suffix = hashlib.md5(s.encode("utf8"), usedforsecurity=False).hexdigest()[:6]

I can do a PR if that's easier - I've tested these updates locally and in FIPS environments and they work, but pytest does not pass tests (master is also failing the pytests in the same way).

Note that a similar issue exists in the pint library where hashlib.blake2b is used - in order to allow datasette to run in FIPS this needs to be modified to, for example, hashlib.sha512 .

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions