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 35a09c12b5a..db7d9be9a97 100644 --- a/scripts/icehashpassword.py +++ b/scripts/icehashpassword.py @@ -8,20 +8,17 @@ # # ********************************************************************** -import sys, getopt, passlib.hash, getpass +import sys, getopt, passlib.hash, passlib.hosts, getpass usePBKDF2 = any(sys.platform == p for p in ["win32", "darwin"]) useCryptExt = any(sys.platform.startswith(p) for p in ["linux", "freebsd", "gnukfreebsd"]) -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") @@ -104,7 +101,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" % |