Skip to content

Commit c6375c1

Browse files
authored
use != 0 rather than == 1 and update a comment.
1 parent 28d8035 commit c6375c1

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

Lib/hashlib.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def __usedforsecurity_check(md, name, *args, **kwargs):
9191
# implementations are treated as an unapproved implementation, as they
9292
# are unlikely to have been certified by NIST.
9393
def __get_wrapped_builtin(md, name):
94-
if _hashlib is not None and _hashlib.get_fips_mode() == 1:
94+
if _hashlib is not None and _hashlib.get_fips_mode() != 0:
9595
from functools import partial
9696
return partial(__usedforsecurity_check, md, name)
9797
return md
@@ -178,8 +178,7 @@ def __hash_new(name, data=b'', **kwargs):
178178
except ValueError:
179179
# If the _hashlib module (OpenSSL) doesn't support the named
180180
# hash, try using our builtin implementations.
181-
# This allows for SHA224/256 and SHA384/512 support even though
182-
# the OpenSSL library prior to 0.9.8 doesn't provide them.
181+
# OpenSSL may not have been compiled to support everything.
183182
return __get_builtin_constructor(name)(data, **kwargs)
184183

185184

0 commit comments

Comments
 (0)