scripts

random assortment of scripts
git clone git://git.andersuno.nu/scripts.git
Log | Files | Refs

gensha512pass.py (468B)


      1 #!/bin/python
      2 
      3 import random
      4 import string
      5 import crypt
      6 import sys
      7 
      8 if sys.version_info[0] < 3:
      9     print("Looks like you are using Python 2, running Python 2 compatible code\
     10  instead")
     11     passwd = raw_input("Enter password to digest: ")
     12 
     13     randomsalt = ''.join(random.sample(string.ascii_letters, 8))
     14     print(crypt.crypt(passwd, '$6$%s$' % randomsalt))
     15 
     16 else:
     17     passwd = input("Enter password to digest: ")
     18     print(crypt.crypt(passwd, crypt.METHOD_SHA512))