Skip to content

Instantly share code, notes, and snippets.

@jfrost
Created September 7, 2015 17:25
Show Gist options
  • Save jfrost/3d27305750f6ea84a1a4 to your computer and use it in GitHub Desktop.
Save jfrost/3d27305750f6ea84a1a4 to your computer and use it in GitHub Desktop.
#!/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