Skip to content

Instantly share code, notes, and snippets.

@FilBot3
Created October 24, 2016 14:04
Show Gist options
  • Select an option

  • Save FilBot3/26a75b9c84fbf9d43ff2d0b561d80577 to your computer and use it in GitHub Desktop.

Select an option

Save FilBot3/26a75b9c84fbf9d43ff2d0b561d80577 to your computer and use it in GitHub Desktop.
Generate a SHA512 Password Hash using Python3's Password Prompt and Crypt Library.
#!/usr/bin/env python
#
# This will not work on Windows because Windows naturally lacks the encryption
# and security libraries that GNU/Linux does. Ie. does not natively have
# OpenSSL installed and its development libraries.
#
import getpass
import crypt
print("Please input your password:")
password_string = getpass.getpass()
print(crypt.crypt(password_string, crypt.mksalt(crypt.METHOD_SHA512)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment