Last active
May 8, 2022 20:42
-
-
Save UnderGrounder96/b29145289f68ce019829a197dff5b24b to your computer and use it in GitHub Desktop.
Create secret keys using python
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 | |
import crypt | |
import getpass | |
# password encryptor, asks for password | |
print(crypt.crypt(getpass.getpass())) |
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 | |
# The secrets module is only available on Python3+ | |
#import random # Older versions can use random.SystemRandom().choice(...) | |
import secrets | |
import string | |
# 100 is the amount of chars to be printed | |
print("".join(secrets.choice(string.digits + string.ascii_letters + string.punctuation) for i in range(100))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment