Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/Crypto/Util/_typing.py: 83%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

6 statements  

1# SPDX-FileCopyrightText: 2026 Helder Eijs <helderijs@gmail.com> 

2# SPDX-License-Identifier: BSD-2-Clause 

3 

4"""Type aliases shared by the PyCryptodome modules (for annotations only). 

5 

6This module must not import anything from ``Crypto``, so that any module can 

7import it without creating an import cycle.""" 

8 

9from typing import Callable, Union 

10 

11# The types accepted wherever PyCryptodome reads bytes. 

12# With Python 3.12 as the minimum, it can become collections.abc.Buffer (PEP 688). 

13Buffer = Union[bytes, bytearray, memoryview] 

14 

15# A function that returns the requested number of random bytes 

16RNG = Callable[[int], bytes] 

17 

18# A message as pieces to concatenate, so that a long piece is never copied 

19# (for instance, the message M' of ML-DSA and SLH-DSA: a short prefix and M) 

20Message = tuple[Buffer, ...]