Return to Snippet

Revision: 46125
at May 13, 2011 06:22 by alejandrombernardis


Updated Code
# ref: http://mylesbraithwaite.com/journal/2007/10/secret-key/

def secret_key(l=32):
    from string import letters, digits, punctuation
    from random import choice
    from datetime import datetime

    d = datetime.strftime(datetime.now(), '%Y%m%d%H%M%S%f')
    h = '%s%s%s%s' % (letters, digits, punctuation, d)
    s = ''.join([choice(h) for i in range(l)])

    return s

Revision: 46124
at May 13, 2011 06:17 by alejandrombernardis


Initial Code
def secret_key(l=32):
    from string import letters, digits, punctuation
    from random import choice
    from datetime import datetime

    d = datetime.strftime(datetime.now(), '%Y%m%d%H%M%S%f')
    h = '%s%s%s%s' % (letters, digits, punctuation, d)
    s = ''.join([choice(h) for i in range(l)])

    return s

Initial URL
http://www.alejandrob.com.ar/

Initial Description

                                

Initial Title
Py | Secret Key

Initial Tags

                                

Initial Language
Python