Skip to content

Commit

Permalink
Use ByteString for Salsa20
Browse files Browse the repository at this point in the history
  • Loading branch information
Legrandin committed Jan 27, 2023
1 parent 6675d07 commit dbe7867
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions lib/Crypto/Cipher/Salsa20.pyi
Original file line number Diff line number Diff line change
@@ -1,26 +1,23 @@
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
block_size: int
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]
Expand Down

0 comments on commit dbe7867

Please sign in to comment.