improve frontend, no reloading. types in views_api, formatting

This commit is contained in:
dni ⚡ 2023-03-19 10:04:06 +01:00
parent 802d01cc4b
commit bb1941445d
No known key found for this signature in database
GPG key ID: 886317704CC4E618
19 changed files with 134 additions and 119 deletions

View file

@ -1,4 +1,3 @@
from Cryptodome import Random
from Cryptodome.Cipher import AES
@ -11,10 +10,10 @@ key = bytes.fromhex("3aa925cb69eb613e2928f8a18279c78b1dca04541dfd064df2eda66b598
BLOCK_SIZE = 16
class AESCipher(object):
"""This class is compatible with crypto.createCipheriv('aes-256-cbc')
"""
class AESCipher(object):
"""This class is compatible with crypto.createCipheriv('aes-256-cbc')"""
def __init__(self, key=None):
self.key = key
@ -33,9 +32,10 @@ class AESCipher(object):
def decrypt(self, iv, enc_text):
cipher = AES.new(self.key, AES.MODE_CBC, iv=iv)
return self.unpad(cipher.decrypt(enc_text).decode("UTF-8"))
if __name__ == "__main__":
aes = AESCipher(key=key)
iv, enc_text = aes.encrypt(plain_text)
dec_text = aes.decrypt(iv, enc_text)
print(dec_text)
print(dec_text)