Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # python2
- import os
- import string
- charset = string.ascii_uppercase + string.digits
- random_bytes = os.urandom(25)
- len_charset = len(charset)
- indices = [int(len_charset * (ord(byte) / 256.0)) for byte in random_bytes]
- defaultToken = "".join([charset[index] for index in indices])
- # python3
- "".join(secrets.choice(string.ascii_uppercase + string.digits) for i in range(25))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement