Created
September 22, 2022 02:25
-
-
Save ilyaevseev/7592cc899841150bc11669f926234dc7 to your computer and use it in GitHub Desktop.
Generate bcrypt password for GLAuth
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/python3 | |
# apt install python3-bcrypt | |
import string | |
import random | |
import bcrypt | |
passlen = 30 | |
letters = string.ascii_letters | |
plain = "".join(random.choice(letters) for i in range(passlen)) | |
crypted = bcrypt.hashpw(plain.encode("utf-8"), bcrypt.gensalt()) | |
hexcrypt = "".join("{:02x}".format(c) for c in crypted) | |
print(plain) | |
print(crypted.decode("utf-8")) | |
print(hexcrypt) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment