purepython-aes 0.1.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.1.0/.github/workflows/pre-commit.yml +37 -0
- purepython_aes-0.1.0/.github/workflows/release.yml +155 -0
- purepython_aes-0.1.0/.gitignore +11 -0
- purepython_aes-0.1.0/.pre-commit-config.yaml +48 -0
- purepython_aes-0.1.0/LISENCE.txt +7 -0
- purepython_aes-0.1.0/PKG-INFO +53 -0
- purepython_aes-0.1.0/README.md +5 -0
- purepython_aes-0.1.0/pyproject.toml +182 -0
- purepython_aes-0.1.0/scripts/check-test-marks.sh +21 -0
- purepython_aes-0.1.0/setup.cfg +4 -0
- purepython_aes-0.1.0/src/purepython_aes/__init__.py +33 -0
- purepython_aes-0.1.0/src/purepython_aes/aes/__init__.py +29 -0
- purepython_aes-0.1.0/src/purepython_aes/aes/algorithms/__init__.py +5 -0
- purepython_aes-0.1.0/src/purepython_aes/aes/algorithms/aes128.py +13 -0
- purepython_aes-0.1.0/src/purepython_aes/aes/algorithms/aes192.py +13 -0
- purepython_aes-0.1.0/src/purepython_aes/aes/algorithms/aes256.py +13 -0
- purepython_aes-0.1.0/src/purepython_aes/aes/core/__init__.py +3 -0
- purepython_aes-0.1.0/src/purepython_aes/aes/core/aes.py +54 -0
- purepython_aes-0.1.0/src/purepython_aes/aes/core/expansion.py +44 -0
- purepython_aes-0.1.0/src/purepython_aes/aes/core/operations.py +64 -0
- purepython_aes-0.1.0/src/purepython_aes/aes/core/state.py +210 -0
- purepython_aes-0.1.0/src/purepython_aes/aes/interface.py +28 -0
- purepython_aes-0.1.0/src/purepython_aes/aes/modes/__init__.py +4 -0
- purepython_aes-0.1.0/src/purepython_aes/aes/modes/_base.py +14 -0
- purepython_aes-0.1.0/src/purepython_aes/aes/modes/block/__init__.py +4 -0
- purepython_aes-0.1.0/src/purepython_aes/aes/modes/block/_base.py +35 -0
- purepython_aes-0.1.0/src/purepython_aes/aes/modes/block/ecb.py +21 -0
- purepython_aes-0.1.0/src/purepython_aes/aes/modes/operations.py +16 -0
- purepython_aes-0.1.0/src/purepython_aes/aes/padding/__init__.py +17 -0
- purepython_aes-0.1.0/src/purepython_aes/aes/padding/_base.py +17 -0
- purepython_aes-0.1.0/src/purepython_aes/aes/padding/ansix923.py +23 -0
- purepython_aes-0.1.0/src/purepython_aes/aes/padding/iso10126.py +20 -0
- purepython_aes-0.1.0/src/purepython_aes/aes/padding/iso7816.py +27 -0
- purepython_aes-0.1.0/src/purepython_aes/aes/padding/no.py +16 -0
- purepython_aes-0.1.0/src/purepython_aes/aes/padding/pkcs7.py +19 -0
- purepython_aes-0.1.0/src/purepython_aes/aes/padding/zero.py +22 -0
- purepython_aes-0.1.0/src/purepython_aes/const/__init__.py +26 -0
- purepython_aes-0.1.0/src/purepython_aes/const/aes.py +40 -0
- purepython_aes-0.1.0/src/purepython_aes/const/sbox.py +105 -0
- purepython_aes-0.1.0/src/purepython_aes/py.typed +0 -0
- purepython_aes-0.1.0/src/purepython_aes/types/__init__.py +5 -0
- purepython_aes-0.1.0/src/purepython_aes/types/finite/__init__.py +3 -0
- purepython_aes-0.1.0/src/purepython_aes/types/finite/aliases.py +37 -0
- purepython_aes-0.1.0/src/purepython_aes.egg-info/PKG-INFO +53 -0
- purepython_aes-0.1.0/src/purepython_aes.egg-info/SOURCES.txt +79 -0
- purepython_aes-0.1.0/src/purepython_aes.egg-info/dependency_links.txt +1 -0
- purepython_aes-0.1.0/src/purepython_aes.egg-info/requires.txt +29 -0
- purepython_aes-0.1.0/src/purepython_aes.egg-info/scm_file_list.json +76 -0
- purepython_aes-0.1.0/src/purepython_aes.egg-info/scm_version.json +8 -0
- purepython_aes-0.1.0/src/purepython_aes.egg-info/top_level.txt +1 -0
- purepython_aes-0.1.0/tests/__init__.py +0 -0
- purepython_aes-0.1.0/tests/test_initial.py +4 -0
- purepython_aes-0.1.0/tests/unit/__init__.py +0 -0
- purepython_aes-0.1.0/tests/unit/aes/__init__.py +1 -0
- purepython_aes-0.1.0/tests/unit/aes/algorithms/__init__.py +0 -0
- purepython_aes-0.1.0/tests/unit/aes/algorithms/conftest.py +16 -0
- purepython_aes-0.1.0/tests/unit/aes/algorithms/test_aes128.py +57 -0
- purepython_aes-0.1.0/tests/unit/aes/algorithms/test_aes192.py +59 -0
- purepython_aes-0.1.0/tests/unit/aes/algorithms/test_aes256.py +63 -0
- purepython_aes-0.1.0/tests/unit/aes/core/__init__.py +0 -0
- purepython_aes-0.1.0/tests/unit/aes/core/strategies.py +9 -0
- purepython_aes-0.1.0/tests/unit/aes/core/test_aes.py +14 -0
- purepython_aes-0.1.0/tests/unit/aes/core/test_expansion.py +122 -0
- purepython_aes-0.1.0/tests/unit/aes/core/test_operations.py +201 -0
- purepython_aes-0.1.0/tests/unit/aes/core/test_state.py +204 -0
- purepython_aes-0.1.0/tests/unit/aes/modes/__init__.py +0 -0
- purepython_aes-0.1.0/tests/unit/aes/modes/block/__init__.py +0 -0
- purepython_aes-0.1.0/tests/unit/aes/modes/block/test_ecb.py +67 -0
- purepython_aes-0.1.0/tests/unit/aes/modes/test_operations.py +141 -0
- purepython_aes-0.1.0/tests/unit/aes/padding/__init__.py +0 -0
- purepython_aes-0.1.0/tests/unit/aes/padding/conftest.py +40 -0
- purepython_aes-0.1.0/tests/unit/aes/padding/strategies.py +8 -0
- purepython_aes-0.1.0/tests/unit/aes/padding/test_ansix923.py +87 -0
- purepython_aes-0.1.0/tests/unit/aes/padding/test_iso10126.py +120 -0
- purepython_aes-0.1.0/tests/unit/aes/padding/test_iso7816.py +83 -0
- purepython_aes-0.1.0/tests/unit/aes/padding/test_no.py +43 -0
- purepython_aes-0.1.0/tests/unit/aes/padding/test_pkcs7.py +79 -0
- purepython_aes-0.1.0/tests/unit/aes/padding/test_zero.py +78 -0
- purepython_aes-0.1.0/tests/unit/aes/strategies.py +35 -0
- purepython_aes-0.1.0/tests/unit/const/__init__.py +0 -0
- purepython_aes-0.1.0/tests/unit/const/test_sbox.py +51 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
name: Pre-commit hooks
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
pull_request:
|
|
8
|
+
branches:
|
|
9
|
+
- main
|
|
10
|
+
|
|
11
|
+
permissions:
|
|
12
|
+
contents: read
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
pre-commit:
|
|
16
|
+
name: Run pre-commit hooks
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
steps:
|
|
19
|
+
- name: Check out repository
|
|
20
|
+
uses: actions/checkout@v4
|
|
21
|
+
- name: Set up Python
|
|
22
|
+
uses: actions/setup-python@v5
|
|
23
|
+
with:
|
|
24
|
+
python-version: "3.10"
|
|
25
|
+
cache: pip
|
|
26
|
+
- name: Install dependencies
|
|
27
|
+
run: python -m pip install --editable ".[dev, test]"
|
|
28
|
+
- name: Cache pre-commit environments
|
|
29
|
+
uses: actions/cache@v4
|
|
30
|
+
with:
|
|
31
|
+
path: ~/.cache/pre-commit
|
|
32
|
+
key: |
|
|
33
|
+
pre-commit-${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml') }}
|
|
34
|
+
restore-keys: |
|
|
35
|
+
pre-commit-${{ runner.os }}-
|
|
36
|
+
- name: Run pre-commit hooks
|
|
37
|
+
run: pre-commit run --all-files --show-diff-on-failure
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*.*.*"
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
validate:
|
|
13
|
+
name: Validate release tag
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
steps:
|
|
16
|
+
- name: Check out tagged commit
|
|
17
|
+
uses: actions/checkout@v4
|
|
18
|
+
with:
|
|
19
|
+
fetch-depth: 0
|
|
20
|
+
- name: Validate tag format
|
|
21
|
+
shell: bash
|
|
22
|
+
run: |
|
|
23
|
+
if [[ ! "$GITHUB_REF_NAME" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
|
24
|
+
echo "Invalid release tag: $GITHUB_REF_NAME"
|
|
25
|
+
echo "Expected a tag of the form v1.2.3"
|
|
26
|
+
exit 1
|
|
27
|
+
fi
|
|
28
|
+
- name: Verify tagged commit belongs to main
|
|
29
|
+
shell: bash
|
|
30
|
+
run: |
|
|
31
|
+
git fetch origin main
|
|
32
|
+
if ! git merge-base --is-ancestor "$GITHUB_SHA" origin/main; then
|
|
33
|
+
echo "The tagged commit is not contained in the main branch."
|
|
34
|
+
exit 1
|
|
35
|
+
fi
|
|
36
|
+
pre-commit:
|
|
37
|
+
name: Run pre-commit hooks
|
|
38
|
+
needs:
|
|
39
|
+
- validate
|
|
40
|
+
runs-on: ubuntu-latest
|
|
41
|
+
steps:
|
|
42
|
+
- name: Check out tagged commit
|
|
43
|
+
uses: actions/checkout@v4
|
|
44
|
+
- name: Set up Python
|
|
45
|
+
uses: actions/setup-python@v5
|
|
46
|
+
with:
|
|
47
|
+
python-version: "3.10"
|
|
48
|
+
cache: pip
|
|
49
|
+
- name: Install dependencies
|
|
50
|
+
run: python -m pip install --editable ".[dev, test]"
|
|
51
|
+
- name: Run pre-commit hooks
|
|
52
|
+
run: pre-commit run --all-files --show-diff-on-failure
|
|
53
|
+
slow-tests:
|
|
54
|
+
name: Run release-only tests
|
|
55
|
+
needs:
|
|
56
|
+
- validate
|
|
57
|
+
runs-on: ubuntu-latest
|
|
58
|
+
steps:
|
|
59
|
+
- name: Check out tagged commit
|
|
60
|
+
uses: actions/checkout@v4
|
|
61
|
+
- name: Set up Python
|
|
62
|
+
uses: actions/setup-python@v5
|
|
63
|
+
with:
|
|
64
|
+
python-version: "3.10"
|
|
65
|
+
cache: pip
|
|
66
|
+
- name: Install dependencies
|
|
67
|
+
run: python -m pip install --editable ".[dev, test]"
|
|
68
|
+
- name: Run slow tests
|
|
69
|
+
run: python -m pytest -n 8 -m "slow and not quick"
|
|
70
|
+
build:
|
|
71
|
+
name: Build distributions
|
|
72
|
+
needs:
|
|
73
|
+
- pre-commit
|
|
74
|
+
- slow-tests
|
|
75
|
+
runs-on: ubuntu-latest
|
|
76
|
+
steps:
|
|
77
|
+
- name: Check out tagged commit
|
|
78
|
+
uses: actions/checkout@v4
|
|
79
|
+
with:
|
|
80
|
+
fetch-depth: 0
|
|
81
|
+
- name: Set up Python 3.10
|
|
82
|
+
uses: actions/setup-python@v5
|
|
83
|
+
with:
|
|
84
|
+
python-version: "3.10"
|
|
85
|
+
- name: Install build tools
|
|
86
|
+
run: python -m pip install --upgrade build twine
|
|
87
|
+
- name: Build wheel and source distribution
|
|
88
|
+
run: python -m build
|
|
89
|
+
- name: Validate distributions
|
|
90
|
+
run: python -m twine check --strict dist/*
|
|
91
|
+
- name: Install built wheel
|
|
92
|
+
shell: bash
|
|
93
|
+
run: python -m pip install --force-reinstall dist/*.whl
|
|
94
|
+
- name: Verify package version matches tag
|
|
95
|
+
shell: bash
|
|
96
|
+
run: |
|
|
97
|
+
expected_version="${GITHUB_REF_NAME#v}"
|
|
98
|
+
actual_version="$(
|
|
99
|
+
python -c \
|
|
100
|
+
"from importlib.metadata import version; print(version('purepython-aes'))"
|
|
101
|
+
)"
|
|
102
|
+
echo "Tag version: $expected_version"
|
|
103
|
+
echo "Package version: $actual_version"
|
|
104
|
+
if [[ "$actual_version" != "$expected_version" ]]; then
|
|
105
|
+
echo "Package version does not match the Git tag."
|
|
106
|
+
exit 1
|
|
107
|
+
fi
|
|
108
|
+
- name: Upload distributions for later jobs
|
|
109
|
+
uses: actions/upload-artifact@v4
|
|
110
|
+
with:
|
|
111
|
+
name: python-package-distributions
|
|
112
|
+
path: dist/
|
|
113
|
+
if-no-files-found: error
|
|
114
|
+
publish:
|
|
115
|
+
name: Publish to PyPI
|
|
116
|
+
needs:
|
|
117
|
+
- build
|
|
118
|
+
runs-on: ubuntu-latest
|
|
119
|
+
environment:
|
|
120
|
+
name: pypi
|
|
121
|
+
url: https://pypi.org/project/purepython-aes/
|
|
122
|
+
permissions:
|
|
123
|
+
id-token: write
|
|
124
|
+
steps:
|
|
125
|
+
- name: Download built distributions
|
|
126
|
+
uses: actions/download-artifact@v4
|
|
127
|
+
with:
|
|
128
|
+
name: python-package-distributions
|
|
129
|
+
path: dist/
|
|
130
|
+
- name: Publish distributions to PyPI
|
|
131
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
132
|
+
github-release:
|
|
133
|
+
name: Create GitHub Release
|
|
134
|
+
needs:
|
|
135
|
+
- publish
|
|
136
|
+
runs-on: ubuntu-latest
|
|
137
|
+
permissions:
|
|
138
|
+
contents: write
|
|
139
|
+
steps:
|
|
140
|
+
- name: Download built distributions
|
|
141
|
+
uses: actions/download-artifact@v4
|
|
142
|
+
with:
|
|
143
|
+
name: python-package-distributions
|
|
144
|
+
path: dist/
|
|
145
|
+
- name: Create GitHub Release
|
|
146
|
+
shell: bash
|
|
147
|
+
run: |
|
|
148
|
+
gh release create "$GITHUB_REF_NAME" \
|
|
149
|
+
dist/* \
|
|
150
|
+
--repo "$GITHUB_REPOSITORY" \
|
|
151
|
+
--verify-tag \
|
|
152
|
+
--title "$GITHUB_REF_NAME" \
|
|
153
|
+
--generate-notes
|
|
154
|
+
env:
|
|
155
|
+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
repos:
|
|
2
|
+
- repo: local
|
|
3
|
+
hooks:
|
|
4
|
+
- id: isort
|
|
5
|
+
name: isort
|
|
6
|
+
entry: isort
|
|
7
|
+
language: system
|
|
8
|
+
types: [python]
|
|
9
|
+
|
|
10
|
+
- id: black
|
|
11
|
+
name: black
|
|
12
|
+
entry: black
|
|
13
|
+
language: system
|
|
14
|
+
types: [python]
|
|
15
|
+
|
|
16
|
+
- id: flake8
|
|
17
|
+
name: flake8
|
|
18
|
+
entry: flake8
|
|
19
|
+
language: system
|
|
20
|
+
types: [python]
|
|
21
|
+
|
|
22
|
+
- id: mypy
|
|
23
|
+
name: mypy
|
|
24
|
+
entry: mypy
|
|
25
|
+
language: system
|
|
26
|
+
types: [python]
|
|
27
|
+
pass_filenames: false
|
|
28
|
+
|
|
29
|
+
- id: pytest-discovery
|
|
30
|
+
name: pytest-discovery
|
|
31
|
+
entry: python -m pytest tests/test_initial.py -n 0
|
|
32
|
+
language: system
|
|
33
|
+
pass_filenames: false
|
|
34
|
+
always_run: true
|
|
35
|
+
|
|
36
|
+
- id: pytest-markguard
|
|
37
|
+
name: pytest-markguard
|
|
38
|
+
entry: scripts/check-test-marks.sh
|
|
39
|
+
language: system
|
|
40
|
+
pass_filenames: false
|
|
41
|
+
always_run: true
|
|
42
|
+
|
|
43
|
+
- id: pytest-unit
|
|
44
|
+
name: pytest-unit
|
|
45
|
+
entry: python -m pytest tests/unit -n 8 -m "quick and not slow"
|
|
46
|
+
language: system
|
|
47
|
+
pass_filenames: false
|
|
48
|
+
always_run: true
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Copyright © 2026 Emelianov Artem
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: purepython-aes
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Pure-Python implementation of AES encryption algorithm.
|
|
5
|
+
Author-email: Emelianov Artem <penguin5726@proton.me>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/Pukhosos/purepython-aes
|
|
8
|
+
Project-URL: Repository, https://github.com/Pukhosos/purepython-aes
|
|
9
|
+
Project-URL: Issues, https://github.com/Pukhosos/purepython-aes/issues
|
|
10
|
+
Classifier: Development Status :: 1 - Planning
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
19
|
+
Classifier: Topic :: Security :: Cryptography
|
|
20
|
+
Classifier: Typing :: Typed
|
|
21
|
+
Requires-Python: >=3.10
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
Provides-Extra: dev
|
|
24
|
+
Requires-Dist: isort; extra == "dev"
|
|
25
|
+
Requires-Dist: black; extra == "dev"
|
|
26
|
+
Requires-Dist: flake8; extra == "dev"
|
|
27
|
+
Requires-Dist: flake8-bugbear; extra == "dev"
|
|
28
|
+
Requires-Dist: flake8-builtins; extra == "dev"
|
|
29
|
+
Requires-Dist: flake8-comprehensions; extra == "dev"
|
|
30
|
+
Requires-Dist: flake8-fixme; extra == "dev"
|
|
31
|
+
Requires-Dist: flake8-pyproject; extra == "dev"
|
|
32
|
+
Requires-Dist: flake8-quotes; extra == "dev"
|
|
33
|
+
Requires-Dist: flake8-simplify; extra == "dev"
|
|
34
|
+
Requires-Dist: pep8-naming; extra == "dev"
|
|
35
|
+
Requires-Dist: mypy; extra == "dev"
|
|
36
|
+
Requires-Dist: pre-commit; extra == "dev"
|
|
37
|
+
Provides-Extra: test
|
|
38
|
+
Requires-Dist: pytest>=9.0; extra == "test"
|
|
39
|
+
Requires-Dist: pytest-env; extra == "test"
|
|
40
|
+
Requires-Dist: pytest-randomly; extra == "test"
|
|
41
|
+
Requires-Dist: pytest-xdist; extra == "test"
|
|
42
|
+
Requires-Dist: hypothesis; extra == "test"
|
|
43
|
+
Provides-Extra: fuzz
|
|
44
|
+
Requires-Dist: hypofuzz; extra == "fuzz"
|
|
45
|
+
Provides-Extra: build
|
|
46
|
+
Requires-Dist: build; extra == "build"
|
|
47
|
+
Requires-Dist: twine; extra == "build"
|
|
48
|
+
|
|
49
|
+
# purepython-aes
|
|
50
|
+
|
|
51
|
+
## License
|
|
52
|
+
|
|
53
|
+
`purepython-aes` is a free, open-source software distributed under the [MIT License](LICENSE.txt)
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "purepython-aes"
|
|
3
|
+
dynamic = ["version"]
|
|
4
|
+
description = "Pure-Python implementation of AES encryption algorithm."
|
|
5
|
+
authors = [{ name = "Emelianov Artem", email = "penguin5726@proton.me" }]
|
|
6
|
+
dependencies = []
|
|
7
|
+
requires-python = ">=3.10"
|
|
8
|
+
readme = "README.md"
|
|
9
|
+
license = "MIT"
|
|
10
|
+
license-files = ["LICENSE.txt"]
|
|
11
|
+
classifiers = [
|
|
12
|
+
"Development Status :: 1 - Planning",
|
|
13
|
+
"Intended Audience :: Developers",
|
|
14
|
+
"Programming Language :: Python :: 3",
|
|
15
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
16
|
+
"Programming Language :: Python :: 3.10",
|
|
17
|
+
"Programming Language :: Python :: 3.11",
|
|
18
|
+
"Programming Language :: Python :: 3.12",
|
|
19
|
+
"Programming Language :: Python :: 3.13",
|
|
20
|
+
"Programming Language :: Python :: 3.14",
|
|
21
|
+
"Topic :: Security :: Cryptography",
|
|
22
|
+
"Typing :: Typed",
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
[project.urls]
|
|
26
|
+
Homepage = "https://github.com/Pukhosos/purepython-aes"
|
|
27
|
+
Repository = "https://github.com/Pukhosos/purepython-aes"
|
|
28
|
+
Issues = "https://github.com/Pukhosos/purepython-aes/issues"
|
|
29
|
+
|
|
30
|
+
[project.optional-dependencies]
|
|
31
|
+
dev = [
|
|
32
|
+
"isort",
|
|
33
|
+
"black",
|
|
34
|
+
"flake8",
|
|
35
|
+
"flake8-bugbear",
|
|
36
|
+
"flake8-builtins",
|
|
37
|
+
"flake8-comprehensions",
|
|
38
|
+
"flake8-fixme",
|
|
39
|
+
"flake8-pyproject",
|
|
40
|
+
"flake8-quotes",
|
|
41
|
+
"flake8-simplify",
|
|
42
|
+
"pep8-naming",
|
|
43
|
+
"mypy",
|
|
44
|
+
"pre-commit",
|
|
45
|
+
]
|
|
46
|
+
test = [
|
|
47
|
+
"pytest>=9.0",
|
|
48
|
+
"pytest-env",
|
|
49
|
+
"pytest-randomly",
|
|
50
|
+
"pytest-xdist",
|
|
51
|
+
"hypothesis",
|
|
52
|
+
]
|
|
53
|
+
fuzz = ["hypofuzz"]
|
|
54
|
+
build = ["build", "twine"]
|
|
55
|
+
|
|
56
|
+
[build-system]
|
|
57
|
+
requires = ["setuptools>=77.0", "setuptools-scm>=8"]
|
|
58
|
+
build-backend = "setuptools.build_meta"
|
|
59
|
+
|
|
60
|
+
[tool.setuptools]
|
|
61
|
+
package-dir = {"" = "src"}
|
|
62
|
+
|
|
63
|
+
[tool.setuptools.packages.find]
|
|
64
|
+
where = ["src"]
|
|
65
|
+
|
|
66
|
+
[tool.setuptools.package-data]
|
|
67
|
+
purepython-aes = ["py.typed"]
|
|
68
|
+
|
|
69
|
+
[tool.setuptools_scm]
|
|
70
|
+
tag_regex = "^v(?P<version>\\d+\\.\\d+\\.\\d+)$"
|
|
71
|
+
parentdir_prefix_version = "purepython-aes-"
|
|
72
|
+
fallback_version = "0.0.0"
|
|
73
|
+
version_file = "src/purepython-aes/_version.py"
|
|
74
|
+
write_to_source = true
|
|
75
|
+
|
|
76
|
+
[tool.isort]
|
|
77
|
+
py_version = 310
|
|
78
|
+
skip_gitignore = true
|
|
79
|
+
line_length = 88
|
|
80
|
+
multi_line_output = 3
|
|
81
|
+
use_parentheses = true
|
|
82
|
+
atomic = true
|
|
83
|
+
lines_before_imports = 0
|
|
84
|
+
combine_star = true
|
|
85
|
+
include_trailing_comma = true
|
|
86
|
+
from_first = true
|
|
87
|
+
verbose = true
|
|
88
|
+
force_alphabetical_sort_within_sections = true
|
|
89
|
+
profile = "black"
|
|
90
|
+
honor_noqa = true
|
|
91
|
+
src_paths = ["src", "tests"]
|
|
92
|
+
remove_redundant_aliases = true
|
|
93
|
+
float_to_top = true
|
|
94
|
+
only_modified = true
|
|
95
|
+
star_first = true
|
|
96
|
+
|
|
97
|
+
[tool.black]
|
|
98
|
+
target-version = ["py310"]
|
|
99
|
+
line-length = 88
|
|
100
|
+
skip-string-normalization = true
|
|
101
|
+
|
|
102
|
+
[tool.flake8]
|
|
103
|
+
count = true
|
|
104
|
+
max-line-length = 88
|
|
105
|
+
statistics = true
|
|
106
|
+
max-complexity = 16
|
|
107
|
+
exclude = [
|
|
108
|
+
"__pycache__",
|
|
109
|
+
".git",
|
|
110
|
+
".hypothesis",
|
|
111
|
+
".mypy_cache",
|
|
112
|
+
".pytest_cache",
|
|
113
|
+
".venv",
|
|
114
|
+
"build",
|
|
115
|
+
"dist",
|
|
116
|
+
"src/purepython-aes/_version.py",
|
|
117
|
+
]
|
|
118
|
+
extend-select = ["A", "B", "B9", "C4", "N", "Q", "SIM"]
|
|
119
|
+
extend-ignore = ["E203", "W503"]
|
|
120
|
+
inline-quotes = "single"
|
|
121
|
+
multiline-quotes = "double"
|
|
122
|
+
docstring-quotes = "double"
|
|
123
|
+
avoid-escape = false
|
|
124
|
+
check-inside-f-strings = true
|
|
125
|
+
|
|
126
|
+
[tool.mypy]
|
|
127
|
+
python_version = "3.10"
|
|
128
|
+
files = ["src", "tests"]
|
|
129
|
+
mypy_path = ["src", "tests"]
|
|
130
|
+
disallow_untyped_calls = true
|
|
131
|
+
disallow_untyped_defs = true
|
|
132
|
+
disallow_incomplete_defs = true
|
|
133
|
+
check_untyped_defs = true
|
|
134
|
+
disallow_untyped_decorators = true
|
|
135
|
+
strict_optional = true
|
|
136
|
+
warn_redundant_casts = true
|
|
137
|
+
warn_unused_ignores = true
|
|
138
|
+
warn_no_return = true
|
|
139
|
+
warn_return_any = true
|
|
140
|
+
warn_unreachable = true
|
|
141
|
+
allow_untyped_globals = false
|
|
142
|
+
allow_redefinition = false
|
|
143
|
+
extra_checks = true
|
|
144
|
+
implicit_reexport = true
|
|
145
|
+
strict_equality = true
|
|
146
|
+
strict_bytes = true
|
|
147
|
+
show_error_context = true
|
|
148
|
+
show_column_numbers = true
|
|
149
|
+
show_error_code_links = true
|
|
150
|
+
pretty = true
|
|
151
|
+
error_summary = true
|
|
152
|
+
warn_incomplete_stub = true
|
|
153
|
+
|
|
154
|
+
[tool.pytest]
|
|
155
|
+
minversion = "9.0"
|
|
156
|
+
env = ["IS_PYTEST_RUNNING=1"]
|
|
157
|
+
addopts = [
|
|
158
|
+
"-ra",
|
|
159
|
+
"-q",
|
|
160
|
+
"-l",
|
|
161
|
+
"--import-mode=importlib",
|
|
162
|
+
"--doctest-modules",
|
|
163
|
+
"--doctest-glob=*.md",
|
|
164
|
+
]
|
|
165
|
+
markers = [
|
|
166
|
+
"quick: run on every commit",
|
|
167
|
+
"slow: only run at new release",
|
|
168
|
+
]
|
|
169
|
+
testpaths = ["."]
|
|
170
|
+
norecursedirs = [
|
|
171
|
+
"__pycache__",
|
|
172
|
+
".git",
|
|
173
|
+
".hypothesis",
|
|
174
|
+
".mypy_cache",
|
|
175
|
+
".pytest_cache",
|
|
176
|
+
".venv",
|
|
177
|
+
"build",
|
|
178
|
+
"dist",
|
|
179
|
+
]
|
|
180
|
+
strict = true
|
|
181
|
+
truncation_limit_chars = "0"
|
|
182
|
+
truncation_limit_lines = "0"
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
output="$(
|
|
4
|
+
python -m pytest tests/unit --collect-only \
|
|
5
|
+
-n 0 -m "not quick and not slow" 2>&1
|
|
6
|
+
)"
|
|
7
|
+
status=$?
|
|
8
|
+
|
|
9
|
+
case "$status" in
|
|
10
|
+
0)
|
|
11
|
+
printf '%s\n' "$output"
|
|
12
|
+
exit 1
|
|
13
|
+
;;
|
|
14
|
+
5)
|
|
15
|
+
exit 0
|
|
16
|
+
;;
|
|
17
|
+
*)
|
|
18
|
+
printf '%s\n' "$output" >&2
|
|
19
|
+
exit "$status"
|
|
20
|
+
;;
|
|
21
|
+
esac
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
from purepython_aes.aes import (
|
|
2
|
+
Aes,
|
|
3
|
+
Aes128,
|
|
4
|
+
Aes192,
|
|
5
|
+
Aes256,
|
|
6
|
+
AesMode,
|
|
7
|
+
AnsiX923Padding,
|
|
8
|
+
BasePadding,
|
|
9
|
+
BlockCipherMode,
|
|
10
|
+
EcbMode,
|
|
11
|
+
Iso7816Padding,
|
|
12
|
+
Iso10126Padding,
|
|
13
|
+
NoPadding,
|
|
14
|
+
Pkcs7Padding,
|
|
15
|
+
ZeroPadding,
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
__all__: list[str] = [
|
|
19
|
+
'Aes',
|
|
20
|
+
'Aes128',
|
|
21
|
+
'Aes192',
|
|
22
|
+
'Aes256',
|
|
23
|
+
'AesMode',
|
|
24
|
+
'AnsiX923Padding',
|
|
25
|
+
'BasePadding',
|
|
26
|
+
'BlockCipherMode',
|
|
27
|
+
'EcbMode',
|
|
28
|
+
'Iso7816Padding',
|
|
29
|
+
'Iso10126Padding',
|
|
30
|
+
'NoPadding',
|
|
31
|
+
'Pkcs7Padding',
|
|
32
|
+
'ZeroPadding',
|
|
33
|
+
]
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
from purepython_aes.aes.algorithms import Aes128, Aes192, Aes256
|
|
2
|
+
from purepython_aes.aes.interface import Aes
|
|
3
|
+
from purepython_aes.aes.modes import AesMode, BlockCipherMode, EcbMode
|
|
4
|
+
from purepython_aes.aes.padding import (
|
|
5
|
+
AnsiX923Padding,
|
|
6
|
+
BasePadding,
|
|
7
|
+
Iso7816Padding,
|
|
8
|
+
Iso10126Padding,
|
|
9
|
+
NoPadding,
|
|
10
|
+
Pkcs7Padding,
|
|
11
|
+
ZeroPadding,
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
__all__: list[str] = [
|
|
15
|
+
'Aes128',
|
|
16
|
+
'Aes192',
|
|
17
|
+
'Aes256',
|
|
18
|
+
'Aes',
|
|
19
|
+
'AesMode',
|
|
20
|
+
'BlockCipherMode',
|
|
21
|
+
'EcbMode',
|
|
22
|
+
'AnsiX923Padding',
|
|
23
|
+
'BasePadding',
|
|
24
|
+
'Iso7816Padding',
|
|
25
|
+
'Iso10126Padding',
|
|
26
|
+
'NoPadding',
|
|
27
|
+
'Pkcs7Padding',
|
|
28
|
+
'ZeroPadding',
|
|
29
|
+
]
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
from typing import ClassVar
|
|
3
|
+
|
|
4
|
+
from purepython_aes.aes.core import AesCore
|
|
5
|
+
from purepython_aes.const import AES_128_KEY_SIZE, AES_128_ROUND_COUNT
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@dataclass(init=False, slots=True)
|
|
9
|
+
class Aes128(AesCore):
|
|
10
|
+
"""AES-128 encryption algorithm."""
|
|
11
|
+
|
|
12
|
+
__key_size__: ClassVar[int] = AES_128_KEY_SIZE
|
|
13
|
+
__round_count__: ClassVar[int] = AES_128_ROUND_COUNT
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
from typing import ClassVar
|
|
3
|
+
|
|
4
|
+
from purepython_aes.aes.core import AesCore
|
|
5
|
+
from purepython_aes.const import AES_192_KEY_SIZE, AES_192_ROUND_COUNT
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@dataclass(init=False, slots=True)
|
|
9
|
+
class Aes192(AesCore):
|
|
10
|
+
"""AES-192 encryption algorithm."""
|
|
11
|
+
|
|
12
|
+
__key_size__: ClassVar[int] = AES_192_KEY_SIZE
|
|
13
|
+
__round_count__: ClassVar[int] = AES_192_ROUND_COUNT
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
from typing import ClassVar
|
|
3
|
+
|
|
4
|
+
from purepython_aes.aes.core import AesCore
|
|
5
|
+
from purepython_aes.const import AES_256_KEY_SIZE, AES_256_ROUND_COUNT
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@dataclass(init=False, slots=True)
|
|
9
|
+
class Aes256(AesCore):
|
|
10
|
+
"""AES-256 encryption algorithm."""
|
|
11
|
+
|
|
12
|
+
__key_size__: ClassVar[int] = AES_256_KEY_SIZE
|
|
13
|
+
__round_count__: ClassVar[int] = AES_256_ROUND_COUNT
|