From dbe7867a5e992cd95e9e6e8af6fb86441da65f53 Mon Sep 17 00:00:00 2001 From: Helder Eijs Date: Fri, 27 Jan 2023 23:52:10 +0100 Subject: [PATCH] Use ByteString for Salsa20 --- lib/Crypto/Cipher/Salsa20.pyi | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/lib/Crypto/Cipher/Salsa20.pyi b/lib/Crypto/Cipher/Salsa20.pyi index 9178f0d53..cc56808d5 100644 --- a/lib/Crypto/Cipher/Salsa20.pyi +++ b/lib/Crypto/Cipher/Salsa20.pyi @@ -1,7 +1,4 @@ -from typing import Union, Tuple, Optional, overload - - -Buffer = Union[bytes, bytearray, memoryview] +from typing import Union, Tuple, Optional, overload, ByteString, Optional class Salsa20Cipher: nonce: bytes @@ -9,18 +6,18 @@ class Salsa20Cipher: key_size: int def __init__(self, - key: Buffer, - nonce: Buffer) -> None: ... + key: ByteString, + nonce: ByteString) -> None: ... @overload - def encrypt(self, plaintext: Buffer) -> bytes: ... + def encrypt(self, plaintext: ByteString) -> bytes: ... @overload - def encrypt(self, plaintext: Buffer, output: Union[bytearray, memoryview]) -> None: ... + def encrypt(self, plaintext: ByteString, output: Union[bytearray, memoryview]) -> None: ... @overload - def decrypt(self, plaintext: Buffer) -> bytes: ... + def decrypt(self, plaintext: ByteString) -> bytes: ... @overload - def decrypt(self, plaintext: Buffer, output: Union[bytearray, memoryview]) -> None: ... + def decrypt(self, plaintext: ByteString, output: Union[bytearray, memoryview]) -> None: ... -def new(key: Buffer, nonce: Optional[Buffer] = ...) -> Salsa20Cipher: ... +def new(key: ByteString, nonce: Optional[ByteString] = ...) -> Salsa20Cipher: ... block_size: int key_size: Tuple[int, int]