Advertisement
Guest User

Untitled

a guest
May 20th, 2019
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. # python2
  2. import os
  3. import string
  4.  
  5. charset = string.ascii_uppercase + string.digits
  6. random_bytes = os.urandom(25)
  7. len_charset = len(charset)
  8. indices = [int(len_charset * (ord(byte) / 256.0)) for byte in random_bytes]
  9. defaultToken = "".join([charset[index] for index in indices])
  10.  
  11. # python3
  12. "".join(secrets.choice(string.ascii_uppercase + string.digits) for i in range(25))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement