Skip to content

Instantly share code, notes, and snippets.

@mvanorder
Last active July 20, 2019 03:10
Show Gist options
  • Save mvanorder/33c7da77e2e6b81a10796feb1ada18ec to your computer and use it in GitHub Desktop.
Save mvanorder/33c7da77e2e6b81a10796feb1ada18ec to your computer and use it in GitHub Desktop.
Generate a random key string
# Generate a random string of random characters randomized in lenght of 42 to 64
# the characters used are char 33 through 126, or:
# '!"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~'
print(''.join((chr(random.randrange(33, 127)) for i in range(random.randrange(42, 65)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment