Skip to content

Instantly share code, notes, and snippets.

@AJamesPhillips
Last active August 31, 2021 08:24
Show Gist options
  • Save AJamesPhillips/319d9618205a77038eb300a297cbf76f to your computer and use it in GitHub Desktop.
Save AJamesPhillips/319d9618205a77038eb300a297cbf76f to your computer and use it in GitHub Desktop.
Crypto random password
import random;
import string;
N = 10
''.join(random.SystemRandom().choice(string.ascii_letters + string.digits) for _ in range(N))
N = 5
word_file = "/usr/share/dict/words" # only works in *nix, https://stackoverflow.com/a/18835426/539490
WORDS = open(word_file).read().splitlines()
''.join(random.SystemRandom().choice(WORDS).capitalize() for _ in range(N))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment