ciyidogan commited on
Commit
d3a3d95
·
verified ·
1 Parent(s): f29818e

Rename generate_password_hash.py to generate_key.py

Browse files
Files changed (2) hide show
  1. generate_key.py +18 -0
  2. generate_password_hash.py +0 -10
generate_key.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """
3
+ generate_key.py
4
+ ----------------------------------
5
+ Çalıştır: python generate_key.py
6
+ Çıktı: 8rSihw0d3Sh_ceyDYobMHNPrgSg0riwGSK4Vco3O5qA=
7
+ Bu çıktıyı ortam değişkeni (veya HF Spaces `Secrets`) olarak kullan.
8
+
9
+ Not: cryptography==42.x yüklü olmalı (requirements.txt’de varsa yeterli).
10
+ """
11
+ from cryptography.fernet import Fernet
12
+
13
+ def main():
14
+ key = Fernet.generate_key().decode()
15
+ print(key)
16
+
17
+ if __name__ == "__main__":
18
+ main()
generate_password_hash.py DELETED
@@ -1,10 +0,0 @@
1
- import hashlib
2
-
3
- def generate_password_hash(password):
4
- hash_value = hashlib.sha256(password.encode()).hexdigest()
5
- return hash_value
6
-
7
- if __name__ == "__main__":
8
- password = input("Enter the password to hash: ")
9
- hash_result = generate_password_hash(password)
10
- print(f"SHA256 Hash:\n{hash_result}")