Created
March 29, 2022 11:20
-
-
Save wmelvin/2f2ae053f33407a95ab2e744b6664a16 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# https://docs.python.org/3/library/secrets.html | |
import secrets | |
s = secrets.token_urlsafe(15) | |
n1 = secrets.randbelow(len(s)) | |
n2 = secrets.randbelow(len(s)) | |
a = '~!@#$%^&*()-_+=:;' | |
a1 = secrets.choice(a) | |
a2 = secrets.choice(a) | |
t = s[:n1] + a1 + s[n1:] | |
t = t[:n2] + a2 + t[n2:] | |
print(t) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment