Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
generate SHA512 hashed and verified passwords on OSX with either python2 or python3. Should work on other platforms as well.
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