mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
parent
9d1b280689
commit
c14eece0c6
1 changed files with 5 additions and 1 deletions
|
@ -225,7 +225,11 @@ def get_encrypted_password(password, hashtype='sha512', salt=None):
|
||||||
if hashtype in cryptmethod:
|
if hashtype in cryptmethod:
|
||||||
if salt is None:
|
if salt is None:
|
||||||
r = SystemRandom()
|
r = SystemRandom()
|
||||||
salt = ''.join([r.choice(string.ascii_letters + string.digits) for _ in range(16)])
|
if hashtype in ['md5']:
|
||||||
|
saltsize = 8
|
||||||
|
else:
|
||||||
|
saltsize = 16
|
||||||
|
salt = ''.join([r.choice(string.ascii_letters + string.digits) for _ in range(saltsize)])
|
||||||
|
|
||||||
if not HAS_PASSLIB:
|
if not HAS_PASSLIB:
|
||||||
if sys.platform.startswith('darwin'):
|
if sys.platform.startswith('darwin'):
|
||||||
|
|
Loading…
Reference in a new issue