Forked from vivianspencer/gist:1bf32ef808e7a8863d8e6c461d885278
Last active
May 18, 2020 16:02
-
-
Save dcode/a32580819908be2fe26930c2239bf589 to your computer and use it in GitHub Desktop.
generate SHA512 hashed and verified passwords on OSX with either python2 or python3. Should work on other platforms as well.
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
pip install passlib | |
cat << EOF | python | |
from __future__ import print_function; | |
from passlib.hash import sha512_crypt; | |
import getpass; | |
import sys, os; | |
hash = sha512_crypt.hash(getpass.getpass()) | |
if sha512_crypt.verify(getpass.getpass("Verify password:"), hash): | |
print(hash) | |
else: | |
print("Passwords did not match.", file=sys.stderr) | |
os.exit(1) | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment