purepython-aes 0.5.0__tar.gz → 0.6.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {purepython_aes-0.5.0/src/purepython_aes.egg-info → purepython_aes-0.6.0}/PKG-INFO +1 -1
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes/__init__.py +2 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes/aes/__init__.py +2 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes/aes/modes/__init__.py +2 -1
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes/aes/modes/stream/__init__.py +2 -1
- purepython_aes-0.6.0/src/purepython_aes/aes/modes/stream/ctr.py +50 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0/src/purepython_aes.egg-info}/PKG-INFO +1 -1
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes.egg-info/SOURCES.txt +2 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes.egg-info/scm_file_list.json +2 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes.egg-info/scm_version.json +2 -2
- purepython_aes-0.6.0/tests/unit/aes/modes/stream/test_ctr.py +28 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/.github/workflows/pre-commit.yml +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/.github/workflows/release.yml +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/.gitignore +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/.pre-commit-config.yaml +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/LISENCE.txt +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/README.md +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/pyproject.toml +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/scripts/check-test-marks.sh +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/setup.cfg +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes/aes/core/__init__.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes/aes/core/fast/__init__.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes/aes/core/fast/aes.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes/aes/core/fast/algorithms/__init__.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes/aes/core/fast/algorithms/aes128.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes/aes/core/fast/algorithms/aes192.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes/aes/core/fast/algorithms/aes256.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes/aes/core/fast/expansion.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes/aes/core/fast/keys.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes/aes/core/fast/ttables.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes/aes/core/interface.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes/aes/core/reference/__init__.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes/aes/core/reference/aes.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes/aes/core/reference/algorithms/__init__.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes/aes/core/reference/algorithms/aes128.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes/aes/core/reference/algorithms/aes192.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes/aes/core/reference/algorithms/aes256.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes/aes/core/reference/expansion.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes/aes/core/reference/operations.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes/aes/core/reference/state.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes/aes/modes/_base.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes/aes/modes/block/__init__.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes/aes/modes/block/_base.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes/aes/modes/block/cbc.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes/aes/modes/block/ecb.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes/aes/modes/block/pcbc.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes/aes/modes/operations.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes/aes/modes/stream/_base.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes/aes/modes/stream/cfb.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes/aes/modes/stream/ofb.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes/aes/padding/__init__.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes/aes/padding/_base.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes/aes/padding/ansix923.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes/aes/padding/iso10126.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes/aes/padding/iso7816.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes/aes/padding/no.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes/aes/padding/pkcs7.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes/aes/padding/zero.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes/const/__init__.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes/const/aes.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes/const/sbox.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes/py.typed +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes/types/__init__.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes/types/finite/__init__.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes/types/finite/aliases.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes/types/finite/literals.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes.egg-info/dependency_links.txt +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes.egg-info/requires.txt +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes.egg-info/top_level.txt +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/tests/__init__.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/tests/test_initial.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/tests/unit/__init__.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/tests/unit/aes/__init__.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/tests/unit/aes/core/__init__.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/tests/unit/aes/core/conftest.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/tests/unit/aes/core/fast/__init__.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/tests/unit/aes/core/fast/algorithms/__init__.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/tests/unit/aes/core/fast/algorithms/strategies.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/tests/unit/aes/core/fast/algorithms/test_aes128.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/tests/unit/aes/core/fast/algorithms/test_aes192.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/tests/unit/aes/core/fast/algorithms/test_aes256.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/tests/unit/aes/core/fast/test_aes.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/tests/unit/aes/core/fast/test_expansion.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/tests/unit/aes/core/fast/test_keys.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/tests/unit/aes/core/fast/test_ttables.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/tests/unit/aes/core/reference/__init__.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/tests/unit/aes/core/reference/algorithms/__init__.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/tests/unit/aes/core/reference/algorithms/strategies.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/tests/unit/aes/core/reference/algorithms/test_aes128.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/tests/unit/aes/core/reference/algorithms/test_aes192.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/tests/unit/aes/core/reference/algorithms/test_aes256.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/tests/unit/aes/core/reference/test_aes.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/tests/unit/aes/core/reference/test_expansion.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/tests/unit/aes/core/reference/test_operations.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/tests/unit/aes/core/reference/test_state.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/tests/unit/aes/core/strategies.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/tests/unit/aes/modes/__init__.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/tests/unit/aes/modes/block/__init__.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/tests/unit/aes/modes/block/test_cbc.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/tests/unit/aes/modes/block/test_ecb.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/tests/unit/aes/modes/block/test_pcbc.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/tests/unit/aes/modes/stream/__init__.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/tests/unit/aes/modes/stream/test_cfb.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/tests/unit/aes/modes/stream/test_ofb.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/tests/unit/aes/modes/test_operations.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/tests/unit/aes/padding/__init__.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/tests/unit/aes/padding/conftest.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/tests/unit/aes/padding/strategies.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/tests/unit/aes/padding/test_ansix923.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/tests/unit/aes/padding/test_iso10126.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/tests/unit/aes/padding/test_iso7816.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/tests/unit/aes/padding/test_no.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/tests/unit/aes/padding/test_pkcs7.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/tests/unit/aes/padding/test_zero.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/tests/unit/aes/strategies.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/tests/unit/const/__init__.py +0 -0
- {purepython_aes-0.5.0 → purepython_aes-0.6.0}/tests/unit/const/test_sbox.py +0 -0
|
@@ -10,6 +10,7 @@ from purepython_aes.aes import (
|
|
|
10
10
|
CbcMode,
|
|
11
11
|
CfbMode,
|
|
12
12
|
CipherMode,
|
|
13
|
+
CtrMode,
|
|
13
14
|
EcbMode,
|
|
14
15
|
Iso7816Padding,
|
|
15
16
|
Iso10126Padding,
|
|
@@ -36,6 +37,7 @@ __all__: list[str] = [
|
|
|
36
37
|
'CbcMode',
|
|
37
38
|
'CfbMode',
|
|
38
39
|
'CipherMode',
|
|
40
|
+
'CtrMode',
|
|
39
41
|
'EcbMode',
|
|
40
42
|
'Iso7816Padding',
|
|
41
43
|
'Iso10126Padding',
|
|
@@ -13,6 +13,7 @@ from purepython_aes.aes.modes import (
|
|
|
13
13
|
CbcMode,
|
|
14
14
|
CfbMode,
|
|
15
15
|
CipherMode,
|
|
16
|
+
CtrMode,
|
|
16
17
|
EcbMode,
|
|
17
18
|
OfbMode,
|
|
18
19
|
PcbcMode,
|
|
@@ -41,6 +42,7 @@ __all__: list[str] = [
|
|
|
41
42
|
'CbcMode',
|
|
42
43
|
'CfbMode',
|
|
43
44
|
'CipherMode',
|
|
45
|
+
'CtrMode',
|
|
44
46
|
'EcbMode',
|
|
45
47
|
'OfbMode',
|
|
46
48
|
'PcbcMode',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from purepython_aes.aes.modes._base import AesMode, CipherMode
|
|
2
2
|
from purepython_aes.aes.modes.block import BlockCipherMode, CbcMode, EcbMode, PcbcMode
|
|
3
|
-
from purepython_aes.aes.modes.stream import CfbMode, OfbMode, StreamCipherMode
|
|
3
|
+
from purepython_aes.aes.modes.stream import CfbMode, CtrMode, OfbMode, StreamCipherMode
|
|
4
4
|
|
|
5
5
|
__all__: list[str] = [
|
|
6
6
|
'AesMode',
|
|
@@ -10,6 +10,7 @@ __all__: list[str] = [
|
|
|
10
10
|
'EcbMode',
|
|
11
11
|
'PcbcMode',
|
|
12
12
|
'CfbMode',
|
|
13
|
+
'CtrMode',
|
|
13
14
|
'OfbMode',
|
|
14
15
|
'StreamCipherMode',
|
|
15
16
|
]
|
{purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes/aes/modes/stream/__init__.py
RENAMED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from purepython_aes.aes.modes.stream._base import StreamCipherMode
|
|
2
2
|
from purepython_aes.aes.modes.stream.cfb import CfbMode
|
|
3
|
+
from purepython_aes.aes.modes.stream.ctr import CtrMode
|
|
3
4
|
from purepython_aes.aes.modes.stream.ofb import OfbMode
|
|
4
5
|
|
|
5
|
-
__all__: list[str] = ['StreamCipherMode', 'CfbMode', 'OfbMode']
|
|
6
|
+
__all__: list[str] = ['StreamCipherMode', 'CfbMode', 'CtrMode', 'OfbMode']
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# src/purepython_aes/aes/modes/stream/ctr.py
|
|
2
|
+
from dataclasses import dataclass
|
|
3
|
+
from typing import final
|
|
4
|
+
|
|
5
|
+
from purepython_aes.aes.modes.operations import xor
|
|
6
|
+
from purepython_aes.aes.modes.stream._base import StreamCipherMode
|
|
7
|
+
from purepython_aes.const import AES_BLOCK_SIZE
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@final
|
|
11
|
+
@dataclass(slots=True)
|
|
12
|
+
class CtrMode(StreamCipherMode):
|
|
13
|
+
"""Counter mode of operation."""
|
|
14
|
+
|
|
15
|
+
def __encrypt_stream__(
|
|
16
|
+
self,
|
|
17
|
+
initialization_value: bytes,
|
|
18
|
+
plaintext: bytes,
|
|
19
|
+
) -> bytes:
|
|
20
|
+
return self.transform(initialization_value, plaintext)
|
|
21
|
+
|
|
22
|
+
def __decrypt_stream__(
|
|
23
|
+
self,
|
|
24
|
+
initialization_value: bytes,
|
|
25
|
+
ciphertext: bytes,
|
|
26
|
+
) -> bytes:
|
|
27
|
+
return self.transform(initialization_value, ciphertext)
|
|
28
|
+
|
|
29
|
+
def transform(
|
|
30
|
+
self,
|
|
31
|
+
initialization_value: bytes,
|
|
32
|
+
data: bytes,
|
|
33
|
+
) -> bytes:
|
|
34
|
+
"""XOR data with the counter-generated keystream."""
|
|
35
|
+
|
|
36
|
+
block_count: int = (len(data) + AES_BLOCK_SIZE - 1) // AES_BLOCK_SIZE
|
|
37
|
+
initial_counter: int = int.from_bytes(initialization_value, byteorder='big')
|
|
38
|
+
transformed_data: bytearray = bytearray()
|
|
39
|
+
for block_index in range(block_count):
|
|
40
|
+
block_start: int = block_index * AES_BLOCK_SIZE
|
|
41
|
+
data_block: bytes = data[block_start : (block_start + AES_BLOCK_SIZE)]
|
|
42
|
+
counter: int = initial_counter + block_index
|
|
43
|
+
counter_block: bytes = counter.to_bytes(AES_BLOCK_SIZE, byteorder='big')
|
|
44
|
+
keystream_block: bytes = self.algorithm.encrypt_block(counter_block)
|
|
45
|
+
transformed_block: bytes = xor(
|
|
46
|
+
data_block,
|
|
47
|
+
keystream_block[: len(data_block)],
|
|
48
|
+
)
|
|
49
|
+
transformed_data.extend(transformed_block)
|
|
50
|
+
return bytes(transformed_data)
|
|
@@ -47,6 +47,7 @@ src/purepython_aes/aes/modes/block/pcbc.py
|
|
|
47
47
|
src/purepython_aes/aes/modes/stream/__init__.py
|
|
48
48
|
src/purepython_aes/aes/modes/stream/_base.py
|
|
49
49
|
src/purepython_aes/aes/modes/stream/cfb.py
|
|
50
|
+
src/purepython_aes/aes/modes/stream/ctr.py
|
|
50
51
|
src/purepython_aes/aes/modes/stream/ofb.py
|
|
51
52
|
src/purepython_aes/aes/padding/__init__.py
|
|
52
53
|
src/purepython_aes/aes/padding/_base.py
|
|
@@ -99,6 +100,7 @@ tests/unit/aes/modes/block/test_ecb.py
|
|
|
99
100
|
tests/unit/aes/modes/block/test_pcbc.py
|
|
100
101
|
tests/unit/aes/modes/stream/__init__.py
|
|
101
102
|
tests/unit/aes/modes/stream/test_cfb.py
|
|
103
|
+
tests/unit/aes/modes/stream/test_ctr.py
|
|
102
104
|
tests/unit/aes/modes/stream/test_ofb.py
|
|
103
105
|
tests/unit/aes/padding/__init__.py
|
|
104
106
|
tests/unit/aes/padding/conftest.py
|
{purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes.egg-info/scm_file_list.json
RENAMED
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
"src/purepython_aes/aes/modes/__init__.py",
|
|
49
49
|
"src/purepython_aes/aes/modes/operations.py",
|
|
50
50
|
"src/purepython_aes/aes/modes/stream/_base.py",
|
|
51
|
+
"src/purepython_aes/aes/modes/stream/ctr.py",
|
|
51
52
|
"src/purepython_aes/aes/modes/stream/cfb.py",
|
|
52
53
|
"src/purepython_aes/aes/modes/stream/__init__.py",
|
|
53
54
|
"src/purepython_aes/aes/modes/stream/ofb.py",
|
|
@@ -100,6 +101,7 @@
|
|
|
100
101
|
"tests/unit/aes/modes/stream/test_cfb.py",
|
|
101
102
|
"tests/unit/aes/modes/stream/__init__.py",
|
|
102
103
|
"tests/unit/aes/modes/stream/test_ofb.py",
|
|
104
|
+
"tests/unit/aes/modes/stream/test_ctr.py",
|
|
103
105
|
"tests/unit/aes/modes/block/__init__.py",
|
|
104
106
|
"tests/unit/aes/modes/block/test_pcbc.py",
|
|
105
107
|
"tests/unit/aes/modes/block/test_ecb.py",
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
from hypothesis import given
|
|
2
|
+
from hypothesis.strategies import binary
|
|
3
|
+
from pytest import mark
|
|
4
|
+
|
|
5
|
+
from purepython_aes import (
|
|
6
|
+
Aes,
|
|
7
|
+
Aes128,
|
|
8
|
+
Aes192,
|
|
9
|
+
Aes256,
|
|
10
|
+
CtrMode,
|
|
11
|
+
ReferenceAes128,
|
|
12
|
+
ReferenceAes192,
|
|
13
|
+
ReferenceAes256,
|
|
14
|
+
)
|
|
15
|
+
from tests.unit.aes.strategies import aes256key
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@mark.quick
|
|
19
|
+
class TestCtrMode:
|
|
20
|
+
@staticmethod
|
|
21
|
+
@mark.parametrize(
|
|
22
|
+
'aes',
|
|
23
|
+
[Aes128, Aes192, Aes256, ReferenceAes128, ReferenceAes192, ReferenceAes256],
|
|
24
|
+
)
|
|
25
|
+
@given(key=aes256key, data=binary())
|
|
26
|
+
def test_decrypt_inverts_encrypt(aes: type[Aes], key: bytes, data: bytes) -> None:
|
|
27
|
+
ctr: CtrMode = CtrMode(aes(key[:aes.__key_size__])) # fmt: skip
|
|
28
|
+
assert ctr.decrypt(ctr.encrypt(data)) == data
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes/aes/core/fast/algorithms/aes128.py
RENAMED
|
File without changes
|
{purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes/aes/core/fast/algorithms/aes192.py
RENAMED
|
File without changes
|
{purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes/aes/core/fast/algorithms/aes256.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes/aes/core/reference/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes/aes/core/reference/expansion.py
RENAMED
|
File without changes
|
{purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes/aes/core/reference/operations.py
RENAMED
|
File without changes
|
{purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes/aes/core/reference/state.py
RENAMED
|
File without changes
|
|
File without changes
|
{purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes/aes/modes/block/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{purepython_aes-0.5.0 → purepython_aes-0.6.0}/src/purepython_aes.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{purepython_aes-0.5.0 → purepython_aes-0.6.0}/tests/unit/aes/core/fast/algorithms/__init__.py
RENAMED
|
File without changes
|
{purepython_aes-0.5.0 → purepython_aes-0.6.0}/tests/unit/aes/core/fast/algorithms/strategies.py
RENAMED
|
File without changes
|
{purepython_aes-0.5.0 → purepython_aes-0.6.0}/tests/unit/aes/core/fast/algorithms/test_aes128.py
RENAMED
|
File without changes
|
{purepython_aes-0.5.0 → purepython_aes-0.6.0}/tests/unit/aes/core/fast/algorithms/test_aes192.py
RENAMED
|
File without changes
|
{purepython_aes-0.5.0 → purepython_aes-0.6.0}/tests/unit/aes/core/fast/algorithms/test_aes256.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{purepython_aes-0.5.0 → purepython_aes-0.6.0}/tests/unit/aes/core/reference/algorithms/__init__.py
RENAMED
|
File without changes
|
{purepython_aes-0.5.0 → purepython_aes-0.6.0}/tests/unit/aes/core/reference/algorithms/strategies.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{purepython_aes-0.5.0 → purepython_aes-0.6.0}/tests/unit/aes/core/reference/test_expansion.py
RENAMED
|
File without changes
|
{purepython_aes-0.5.0 → purepython_aes-0.6.0}/tests/unit/aes/core/reference/test_operations.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|