mirror of
https://github.com/UrloMythus/UnHided.git
synced 2026-04-11 11:50:51 +00:00
update
This commit is contained in:
@@ -3,13 +3,21 @@
|
||||
|
||||
"""hashlib that handles FIPS mode."""
|
||||
|
||||
# Because we are extending the hashlib module, we need to import all its
|
||||
# fields to suppport the same uses
|
||||
# pylint: disable=unused-wildcard-import, wildcard-import
|
||||
from hashlib import *
|
||||
# pylint: enable=unused-wildcard-import, wildcard-import
|
||||
import hashlib
|
||||
|
||||
# Re-export commonly used hash constructors
|
||||
sha1 = hashlib.sha1
|
||||
sha224 = hashlib.sha224
|
||||
sha256 = hashlib.sha256
|
||||
sha384 = hashlib.sha384
|
||||
sha512 = hashlib.sha512
|
||||
sha3_224 = hashlib.sha3_224
|
||||
sha3_256 = hashlib.sha3_256
|
||||
sha3_384 = hashlib.sha3_384
|
||||
sha3_512 = hashlib.sha3_512
|
||||
blake2b = hashlib.blake2b
|
||||
blake2s = hashlib.blake2s
|
||||
|
||||
|
||||
def _fipsFunction(func, *args, **kwargs):
|
||||
"""Make hash function support FIPS mode."""
|
||||
@@ -19,8 +27,6 @@ def _fipsFunction(func, *args, **kwargs):
|
||||
return func(*args, usedforsecurity=False, **kwargs)
|
||||
|
||||
|
||||
# redefining the function is exactly what we intend to do
|
||||
# pylint: disable=function-redefined
|
||||
def md5(*args, **kwargs):
|
||||
"""MD5 constructor that works in FIPS mode."""
|
||||
return _fipsFunction(hashlib.md5, *args, **kwargs)
|
||||
@@ -29,4 +35,3 @@ def md5(*args, **kwargs):
|
||||
def new(*args, **kwargs):
|
||||
"""General constructor that works in FIPS mode."""
|
||||
return _fipsFunction(hashlib.new, *args, **kwargs)
|
||||
# pylint: enable=function-redefined
|
||||
|
||||
Reference in New Issue
Block a user