diff options
Diffstat (limited to 'scripts/icehashpassword.py')
-rw-r--r-- | scripts/icehashpassword.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/scripts/icehashpassword.py b/scripts/icehashpassword.py index 7f85102f06d..6763143cab3 100644 --- a/scripts/icehashpassword.py +++ b/scripts/icehashpassword.py @@ -8,19 +8,16 @@ # # ********************************************************************** -import sys, getopt, passlib.hash, getpass +import sys, getopt, passlib.hash, passlib.hosts, getpass usePBKDF2 = sys.platform == "win32" or sys.platform == "darwin" useCryptExt = sys.platform.startswith("linux") -if not usePBKDF2 and not useCryptExt: - print("platform not supported") - sys.exit(1) - def usage(): print("Usage: icehashpassword [options]") print("") print("OPTIONS") + if usePBKDF2: print("") print(" -d MESSAGE_DIGEST_ALGORITHM, --digest=MESSAGE_DIGEST_ALGORITHM") @@ -103,7 +100,12 @@ def main(): passScheme = passlib.hash.sha512_crypt if digest == "sha256": passScheme = passlib.hash.sha256_crypt - + else: + # + # Fallback is the OS crypt function + # + passScheme = passlib.hosts.host_context + if rounds: if not passScheme.min_rounds <= rounds <= passScheme.max_rounds: print("Invalid number rounds for the digest algorithm. Value must be an integer between %s and %s" % |