Move from md5 to sha1 to work on fips-140 enabled systems

This commit is contained in:
Toshio Kuratomi 2014-11-06 21:28:04 -08:00
parent 716f3eb6d9
commit f1267c0b05
31 changed files with 238 additions and 139 deletions

View file

@ -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: