Skip to content

Instantly share code, notes, and snippets.

@ilyaevseev
Created September 22, 2022 02:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ilyaevseev/7592cc899841150bc11669f926234dc7 to your computer and use it in GitHub Desktop.
Save ilyaevseev/7592cc899841150bc11669f926234dc7 to your computer and use it in GitHub Desktop.
Generate bcrypt password for GLAuth
#!/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