mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-24 01:00:26 -07:00
Move from md5 to sha1 to work on fips-140 enabled systems
This commit is contained in:
parent
716f3eb6d9
commit
f1267c0b05
31 changed files with 238 additions and 139 deletions
|
@ -87,8 +87,13 @@ except ImportError:
|
|||
|
||||
HAVE_HASHLIB=False
|
||||
try:
|
||||
from hashlib import md5 as _md5
|
||||
from hashlib import sha1 as _sha1
|
||||
HAVE_HASHLIB=True
|
||||
except ImportError:
|
||||
from sha import sha as _sha1
|
||||
|
||||
try:
|
||||
from hashlib import md5 as _md5
|
||||
except ImportError:
|
||||
from md5 import md5 as _md5
|
||||
|
||||
|
@ -1236,6 +1241,10 @@ class AnsibleModule(object):
|
|||
''' Return MD5 hex digest of local file using digest_from_file(). '''
|
||||
return self.digest_from_file(filename, _md5())
|
||||
|
||||
def sha1(self, filename):
|
||||
''' Return SHA1 hex digest of local file using digest_from_file(). '''
|
||||
return self.digest_from_file(filename, _sha1())
|
||||
|
||||
def sha256(self, filename):
|
||||
''' Return SHA-256 hex digest of local file using digest_from_file(). '''
|
||||
if not HAVE_HASHLIB:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue