| 1234567891011121314151617181920 |
- import Crypto
- import hashlib
- import os
- class secret_crypto:
- def __init__(self, password: str):
- self.__iv = os.urandom(16)
- self.__key = self.__create_key(password)
- @property
- def __cipher(self) -> Crypto.Cipher:
- return Crypto.Cipher.AES.new(self.__key
- def __create_key(self, password: str) -> bytes:
- encoded = password.encode("UTF-8")
- hashed = hashlib.sha256(encoded)
- return hashed.digest()
-
-
|