Created
February 28, 2017 10:08
-
-
Save lxhunter/ac41f2cf52884ed72f5fdef779e45748 to your computer and use it in GitHub Desktop.
use python passlib to generate sha512-crypt on osx with optional rounds
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# pip install passlib | |
import getpass | |
import random | |
import string | |
import argparse | |
from passlib.hash import sha512_crypt | |
parser = argparse.ArgumentParser() | |
parser.add_argument('--rounds', type=int, default=5000, help='specify the rounds') | |
args = parser.parse_args() | |
print sha512_crypt.using(salt=''.join([random.choice(string.ascii_letters + string.digits) for _ in range(16)]), | |
rounds=args.rounds).hash(getpass.getpass()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment