Skip to content

Commit

Permalink
Use hashlib.sha256() instead of _sha256.sha256()
Browse files Browse the repository at this point in the history
_sha256 is a CPython extension and is an implementation detail one must
not rely on. Despite being a part of most CPython distributions, _sha256
module may not exist if CPython has been built in so-called FIPS
compliant mode. Examples of such distributions could be found in CentOS
and/or RHEL.

Recommended way of using sha256() is via hashlib module because hashlib
module may choose a hash function implementation based on whether
OpenSSL exist or not. Normally _sha256 module is a fallback
implementation if CPython has not been linked to OpenSSL, but in FIPS
mode it's always linked to OpenSSL.
  • Loading branch information
ikalnytskyi authored and zhukovgreen committed Jul 20, 2020
1 parent bc85da1 commit e978a3d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion aiohttp_cache/backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import enum
import pickle
import time
from _sha256 import sha256
from hashlib import sha256
from typing import Dict, Tuple

import aiohttp.web
Expand Down

0 comments on commit e978a3d

Please sign in to comment.