2018-11-18 22:43:56 +01:00
|
|
|
from typing import Union, overload
|
|
|
|
|
|
2018-11-08 22:03:40 +01:00
|
|
|
from Crypto.Util._raw_api import SmartPointer
|
2018-09-30 02:30:33 +02:00
|
|
|
|
2018-11-18 22:43:56 +01:00
|
|
|
Buffer = Union[bytes, bytearray, memoryview]
|
|
|
|
|
|
2018-09-30 02:30:33 +02:00
|
|
|
__all__ = ['CtrMode']
|
|
|
|
|
|
|
|
|
|
class CtrMode(object):
|
|
|
|
|
block_size: int
|
2018-11-18 22:43:56 +01:00
|
|
|
nonce: bytes
|
|
|
|
|
|
|
|
|
|
def __init__(self,
|
|
|
|
|
block_cipher: SmartPointer,
|
|
|
|
|
initial_counter_block: Buffer,
|
|
|
|
|
prefix_len: int,
|
|
|
|
|
counter_len: int,
|
|
|
|
|
little_endian: bool) -> None: ...
|
|
|
|
|
@overload
|
|
|
|
|
def encrypt(self, plaintext: Buffer) -> bytes: ...
|
|
|
|
|
@overload
|
|
|
|
|
def encrypt(self, plaintext: Buffer, output: Union[bytearray, memoryview]) -> None: ...
|
|
|
|
|
@overload
|
|
|
|
|
def decrypt(self, plaintext: Buffer) -> bytes: ...
|
|
|
|
|
@overload
|
|
|
|
|
def decrypt(self, plaintext: Buffer, output: Union[bytearray, memoryview]) -> None: ...
|
|
|
|
|
|