Skip to content

Commit 725846e

Browse files
committed
Add typing
1 parent 3f24805 commit 725846e

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

padding_oracle.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import base64
33
import urllib.parse
44

5-
from typing import Union
5+
from typing import Union, Callable
66
from concurrent.futures import ThreadPoolExecutor
77

88

@@ -53,16 +53,16 @@ def remove_padding(data: Union[str, bytes]):
5353

5454

5555

56-
def _dummy_oracle(cipher):
56+
def _dummy_oracle(cipher: bytes) -> bool:
5757
raise NotImplementedError('You must implement the oracle function')
5858

5959

60-
def padding_oracle(cipher,
61-
block_size,
62-
oracle=_dummy_oracle,
63-
num_threads=1,
64-
log_level=logging.INFO,
65-
null=b' '):
60+
def padding_oracle(cipher: bytes,
61+
block_size: int,
62+
oracle: Callable[[bytes], bool]=_dummy_oracle,
63+
num_threads: int=1,
64+
log_level: int=logging.INFO,
65+
null: bytes=b' ') -> bytes:
6666
# Check the oracle function
6767
assert callable(oracle), 'the oracle function should be callable'
6868
assert oracle.__code__.co_argcount == 1, 'expect oracle function with only 1 argument'

0 commit comments

Comments
 (0)