File size: 470 Bytes
170ac2b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import hashlib
import getpass

def generate_password_hash():
    """Generate a SHA-256 hash for a password"""
    password = getpass.getpass("Enter the password you want to hash: ")
    if not password:
        print("Password cannot be empty")
        return
    
    hashed = hashlib.sha256(password.encode()).hexdigest()
    print("\nAdd the following line to your .env file:")
    print(f"PASSWORD={hashed}")

if __name__ == "__main__":
    generate_password_hash()