Created
November 26, 2014 09:26
-
-
Save stiandre/9f9085ab052a52f68078 to your computer and use it in GitHub Desktop.
This file contains 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/env python | |
import crypt | |
import sys | |
import random | |
saltchars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" | |
def salt(): | |
return "$6$" + "".join(random.sample(saltchars, 8)) | |
def hash(plain): | |
return crypt.crypt(arg, salt()) | |
if __name__ == "__main__": | |
random.seed() | |
for arg in sys.argv[1:]: | |
sys.stdout.write("%s\n" % (hash(arg),)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment