Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dcode/a32580819908be2fe26930c2239bf589 to your computer and use it in GitHub Desktop.
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.
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