Skip to content

Instantly share code, notes, and snippets.

@UnderGrounder96
Last active May 8, 2022 20:42
Show Gist options
  • Save UnderGrounder96/b29145289f68ce019829a197dff5b24b to your computer and use it in GitHub Desktop.
Save UnderGrounder96/b29145289f68ce019829a197dff5b24b to your computer and use it in GitHub Desktop.
Create secret keys using python
#!/usr/bin/env python3
import crypt
import getpass
# password encryptor, asks for password
print(crypt.crypt(getpass.getpass()))
#!/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