Skip to content

Instantly share code, notes, and snippets.

@PyYoshi
Created July 23, 2012 07:52
Show Gist options
  • Select an option

  • Save PyYoshi/3162470 to your computer and use it in GitHub Desktop.

Select an option

Save PyYoshi/3162470 to your computer and use it in GitHub Desktop.
# coding: utf-8
# http://d.hatena.ne.jp/odz/20070821/1187682903
import string
import random
alphabets = string.digits + string.letters + "!#$%&()*+,-./:;<=>?@[]^_{|}~"
def randstr(n):
return ''.join(random.choice(alphabets) for i in xrange(n))
if __name__ in '__main__':
print 'salt:',randstr(64)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment