Exemplo n.º 1
0
def salt():
    s = ''
    v = long(hexlify(urandom(4)), 16)
    itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
    for i in range(8):
        s += itoa64[v & 0x3f]; v >>= 6
    return s
Exemplo n.º 2
0
 def _gen_token(self):
     return base64.urlsafe_b64encode(urandom(6))