Created
September 7, 2015 17:25
-
-
Save jfrost/3d27305750f6ea84a1a4 to your computer and use it in GitHub Desktop.
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/python | |
import crypt | |
import random | |
import string | |
def getsalt(mysalt = "", chars = string.letters + string.digits): | |
# generate a random 16-character 'salt' | |
for i in range(16): | |
mysalt = mysalt + random.choice(chars) | |
return mysalt | |
salt="$6$" + getsalt() | |
cleartextpassword = raw_input('New password: ') | |
print crypt.crypt(cleartextpassword, salt) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment