Answers for "python encryption and decryption program"

2

encrypt and decrypt python

# encrypting
from cryptography.fernet import Fernet
message = "my deep dark secret".encode()

f = Fernet(key)
encrypted = f.encrypt(message)
# decrypting
from cryptography.fernet import Fernet
encrypted = b"...encrypted bytes..."

f = Fernet(key)
decrypted = f.decrypt(encrypted)
Posted by: Guest on May-24-2020
-1

python code to calculate encryption time

import timeit

setup_code = "from math import factorial"

statement = """
    for i in range(10):
        factorial(i)
"""

print(f"Execution time is: {timeit.timeit(setup = setup_code, stmt = statement, number = 10000000)}")
Posted by: Guest on October-06-2020

Code answers related to "python encryption and decryption program"

Python Answers by Framework

Browse Popular Code Answers by Language