Did aesio

This commit is contained in:
dherrada 2020-07-02 11:10:53 -04:00
parent 1e96ca582e
commit 627ecadb3f

View File

@ -12,7 +12,7 @@
//| class AES: //| class AES:
//| """Encrypt and decrypt AES streams""" //| """Encrypt and decrypt AES streams"""
//| //|
//| def __init__(self, key, mode=0, iv=None, segment_size=8) -> Any: //| def __init__(self, key: bytearray, mode: int=0, iv: bytearray=None, segment_size: int=8) -> AES:
//| """Create a new AES state with the given key. //| """Create a new AES state with the given key.
//| //|
//| :param bytearray key: A 16-, 24-, or 32-byte key //| :param bytearray key: A 16-, 24-, or 32-byte key
@ -152,7 +152,7 @@ STATIC void validate_length(aesio_aes_obj_t *self, size_t src_length,
} }
} }
//| def encrypt_into(src, dest) -> None: //| def encrypt_into(src: bytes, dest: bytearray) -> None:
//| """Encrypt the buffer from ``src`` into ``dest``. //| """Encrypt the buffer from ``src`` into ``dest``.
//| //|
//| For ECB mode, the buffers must be 16 bytes long. For CBC mode, the //| For ECB mode, the buffers must be 16 bytes long. For CBC mode, the
@ -183,7 +183,7 @@ STATIC mp_obj_t aesio_aes_encrypt_into(mp_obj_t aesio_obj, mp_obj_t src,
STATIC MP_DEFINE_CONST_FUN_OBJ_3(aesio_aes_encrypt_into_obj, STATIC MP_DEFINE_CONST_FUN_OBJ_3(aesio_aes_encrypt_into_obj,
aesio_aes_encrypt_into); aesio_aes_encrypt_into);
//| def decrypt_into(src, dest) -> None: //| def decrypt_into(src: bytes, dest: bytearray) -> None:
//| //|
//| """Decrypt the buffer from ``src`` into ``dest``. //| """Decrypt the buffer from ``src`` into ``dest``.
//| For ECB mode, the buffers must be 16 bytes long. For CBC mode, the //| For ECB mode, the buffers must be 16 bytes long. For CBC mode, the