Skip to content

Instantly share code, notes, and snippets.

@stefanpejcic
Created February 28, 2024 14:20
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 stefanpejcic/cbe479c8d1ba4a29140a18282aa62c78 to your computer and use it in GitHub Desktop.
Save stefanpejcic/cbe479c8d1ba4a29140a18282aa62c78 to your computer and use it in GitHub Desktop.
import sys
from werkzeug.security import generate_password_hash
def hash_password(unhashed_password):
hashed_password = generate_password_hash(unhashed_password)
return hashed_password
if __name__ == "__main__":
# Check if the correct number of command-line arguments is provided
if len(sys.argv) != 2:
print("Usage: python hash_password.py <unhashed_password>")
sys.exit(1)
# Get the unhashed password from the command-line argument
unhashed_password = sys.argv[1]
# Hash the password
hashed_password = hash_password(unhashed_password)
# Print the hashed password
print(hashed_password)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment