Created
June 17, 2022 23:29
-
-
Save markallenpark/9ab3918aa869b961809e5f04eb024871 to your computer and use it in GitHub Desktop.
Generate password hash for including in cloud-init scripts
This file contains hidden or 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
#!/bin/env python3 | |
import crypt | |
from getpass import getpass | |
print('Generate password hash\n\n----\n') | |
password = getpass('Password: ') | |
password_confirm = getpass('Confirm Password: ') | |
print('\n') | |
if password == password_confirm: | |
print('Passwords match!\n\n----\n') | |
print('Hash: ' + crypt.crypt(password) + '\n') | |
else: | |
print("Passwords don't match!\n") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment