I am trying to make an application that encodes and decodes a file for security.
What I am trying to achieve is this:
I entered a string 'something' and it will generate a key 'some_key=' everytime.
I tried out doing this:
import os
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
from cryptography.hazmat.backends import default_backend
from cryptography.fernet import Fernet
backend = default_backend()
salt = os.urandom(16)
kdf = PBKDF2HMAC(
algorithm=hashes.SHA256(),
length=32,
salt=salt,
iterations=100000,
backend=backend
)
key = base64.urlsafe_b64encode(kdf.derive(b"my great password"))
f = Fernet(f)
But what i try to do, it is generating random keys.
I dont know what to do. Plz Help!