Skip to content

Instantly share code, notes, and snippets.

@mbstacy
Created December 23, 2015 22:20
Show Gist options
  • Save mbstacy/1a133f2eadd49cc449be to your computer and use it in GitHub Desktop.
Save mbstacy/1a133f2eadd49cc449be to your computer and use it in GitHub Desktop.
Generate random secret key
import os, string
import binascii
key = binascii.hexlify(os.urandom(24)).decode("utf-8")
#Random upper case letters
for i in range(1,15):
char = random.choice(string.ascii_lowercase)
key = "".join(c.upper() if c in var else c for i, c in enumerate(key))
print(key)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment