Startonix / Modular-AI

Advanced AI Training and Building Repository
0 stars 0 forks source link

Encryption with Python's Cryptography Library #141

Open Startonix opened 4 months ago

Startonix commented 4 months ago

encryption_example.py

from cryptography.fernet import Fernet

key = Fernet.generate_key() cipher_suite = Fernet(key) encrypted_text = cipher_suite.encrypt(b"Secret Data") decrypted_text = cipher_suite.decrypt(encrypted_text)

print(f"Encrypted: {encrypted_text}") print(f"Decrypted: {decrypted_text}")