eddsa-threshold 0.2a1__tar.gz → 0.2.0a2__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.
Files changed (79) hide show
  1. eddsa_threshold-0.2.0a2/.github/workflows/release.yaml +70 -0
  2. eddsa_threshold-0.2.0a2/.gitignore +207 -0
  3. eddsa_threshold-0.2.0a2/.vscode/settings.json +15 -0
  4. {eddsa_threshold-0.2a1/src/eddsa_threshold.egg-info → eddsa_threshold-0.2.0a2}/PKG-INFO +1 -1
  5. {eddsa_threshold-0.2a1 → eddsa_threshold-0.2.0a2}/pyproject.toml +3 -2
  6. {eddsa_threshold-0.2a1 → eddsa_threshold-0.2.0a2/src/eddsa_threshold.egg-info}/PKG-INFO +1 -1
  7. {eddsa_threshold-0.2a1 → eddsa_threshold-0.2.0a2}/src/eddsa_threshold.egg-info/SOURCES.txt +19 -1
  8. eddsa_threshold-0.2.0a2/test/eddsa/test_cases_curves.py +19 -0
  9. eddsa_threshold-0.2.0a2/test/eddsa/test_cases_eddsa_vectors.py +109 -0
  10. eddsa_threshold-0.2.0a2/test/eddsa/test_cases_fields.py +15 -0
  11. eddsa_threshold-0.2.0a2/test/eddsa/test_ed25519.py +80 -0
  12. eddsa_threshold-0.2.0a2/test/eddsa/test_ed448.py +57 -0
  13. eddsa_threshold-0.2.0a2/test/eddsa/test_field_arithmetic.py +79 -0
  14. eddsa_threshold-0.2.0a2/test/eddsa/test_keypair_generation.py +35 -0
  15. eddsa_threshold-0.2.0a2/test/eddsa/test_point_arithmetic.py +90 -0
  16. eddsa_threshold-0.2.0a2/test/eddsa/test_point_conversion.py +25 -0
  17. eddsa_threshold-0.2.0a2/test/eddsa/test_point_encoding.py +62 -0
  18. eddsa_threshold-0.2.0a2/test/frost/test_cases_scalars.py +15 -0
  19. eddsa_threshold-0.2.0a2/test/frost/test_cases_simple_frost.py +164 -0
  20. eddsa_threshold-0.2.0a2/test/frost/test_polynomial.py +28 -0
  21. eddsa_threshold-0.2.0a2/test/frost/test_shamir_secret_sharing.py +28 -0
  22. eddsa_threshold-0.2.0a2/test/frost/test_simple_frost.py +141 -0
  23. {eddsa_threshold-0.2a1 → eddsa_threshold-0.2.0a2}/LICENSE +0 -0
  24. {eddsa_threshold-0.2a1 → eddsa_threshold-0.2.0a2}/MANIFEST.in +0 -0
  25. {eddsa_threshold-0.2a1 → eddsa_threshold-0.2.0a2}/README.md +0 -0
  26. {eddsa_threshold-0.2a1 → eddsa_threshold-0.2.0a2}/setup.cfg +0 -0
  27. {eddsa_threshold-0.2a1 → eddsa_threshold-0.2.0a2}/src/eddsa_threshold/__init__.py +0 -0
  28. {eddsa_threshold-0.2a1 → eddsa_threshold-0.2.0a2}/src/eddsa_threshold/eddsa/__init__.py +0 -0
  29. {eddsa_threshold-0.2a1 → eddsa_threshold-0.2.0a2}/src/eddsa_threshold/eddsa/algorithms/__init__.py +0 -0
  30. {eddsa_threshold-0.2a1 → eddsa_threshold-0.2.0a2}/src/eddsa_threshold/eddsa/algorithms/ed25519.py +0 -0
  31. {eddsa_threshold-0.2a1 → eddsa_threshold-0.2.0a2}/src/eddsa_threshold/eddsa/algorithms/ed25519ctx.py +0 -0
  32. {eddsa_threshold-0.2a1 → eddsa_threshold-0.2.0a2}/src/eddsa_threshold/eddsa/algorithms/ed25519ph.py +0 -0
  33. {eddsa_threshold-0.2a1 → eddsa_threshold-0.2.0a2}/src/eddsa_threshold/eddsa/algorithms/ed448.py +0 -0
  34. {eddsa_threshold-0.2a1 → eddsa_threshold-0.2.0a2}/src/eddsa_threshold/eddsa/algorithms/ed448ph.py +0 -0
  35. {eddsa_threshold-0.2a1 → eddsa_threshold-0.2.0a2}/src/eddsa_threshold/eddsa/curves/__init__.py +0 -0
  36. {eddsa_threshold-0.2a1 → eddsa_threshold-0.2.0a2}/src/eddsa_threshold/eddsa/curves/base/__init__.py +0 -0
  37. {eddsa_threshold-0.2a1 → eddsa_threshold-0.2.0a2}/src/eddsa_threshold/eddsa/curves/base/edwards_curve.py +0 -0
  38. {eddsa_threshold-0.2a1 → eddsa_threshold-0.2.0a2}/src/eddsa_threshold/eddsa/curves/base/encoding.py +0 -0
  39. {eddsa_threshold-0.2a1 → eddsa_threshold-0.2.0a2}/src/eddsa_threshold/eddsa/curves/base/field_ops.py +0 -0
  40. {eddsa_threshold-0.2a1 → eddsa_threshold-0.2.0a2}/src/eddsa_threshold/eddsa/curves/base/scalar_ops.py +0 -0
  41. {eddsa_threshold-0.2a1 → eddsa_threshold-0.2.0a2}/src/eddsa_threshold/eddsa/curves/ed25519/__init__.py +0 -0
  42. {eddsa_threshold-0.2a1 → eddsa_threshold-0.2.0a2}/src/eddsa_threshold/eddsa/curves/ed25519/constants.py +0 -0
  43. {eddsa_threshold-0.2a1 → eddsa_threshold-0.2.0a2}/src/eddsa_threshold/eddsa/curves/ed25519/ed25519_curve.py +0 -0
  44. {eddsa_threshold-0.2a1 → eddsa_threshold-0.2.0a2}/src/eddsa_threshold/eddsa/curves/ed25519/encoding.py +0 -0
  45. {eddsa_threshold-0.2a1 → eddsa_threshold-0.2.0a2}/src/eddsa_threshold/eddsa/curves/ed25519/field_ops.py +0 -0
  46. {eddsa_threshold-0.2a1 → eddsa_threshold-0.2.0a2}/src/eddsa_threshold/eddsa/curves/ed25519/scalar_ops.py +0 -0
  47. {eddsa_threshold-0.2a1 → eddsa_threshold-0.2.0a2}/src/eddsa_threshold/eddsa/curves/ed448/__init__.py +0 -0
  48. {eddsa_threshold-0.2a1 → eddsa_threshold-0.2.0a2}/src/eddsa_threshold/eddsa/curves/ed448/constants.py +0 -0
  49. {eddsa_threshold-0.2a1 → eddsa_threshold-0.2.0a2}/src/eddsa_threshold/eddsa/curves/ed448/ed448_curve.py +0 -0
  50. {eddsa_threshold-0.2a1 → eddsa_threshold-0.2.0a2}/src/eddsa_threshold/eddsa/curves/ed448/encoding.py +0 -0
  51. {eddsa_threshold-0.2a1 → eddsa_threshold-0.2.0a2}/src/eddsa_threshold/eddsa/curves/ed448/field_ops.py +0 -0
  52. {eddsa_threshold-0.2a1 → eddsa_threshold-0.2.0a2}/src/eddsa_threshold/eddsa/curves/ed448/scalar_ops.py +0 -0
  53. {eddsa_threshold-0.2a1 → eddsa_threshold-0.2.0a2}/src/eddsa_threshold/eddsa/keys/__init__.py +0 -0
  54. {eddsa_threshold-0.2a1 → eddsa_threshold-0.2.0a2}/src/eddsa_threshold/eddsa/keys/ed25519_keypair.py +0 -0
  55. {eddsa_threshold-0.2a1 → eddsa_threshold-0.2.0a2}/src/eddsa_threshold/eddsa/keys/ed448_keypair.py +0 -0
  56. {eddsa_threshold-0.2a1 → eddsa_threshold-0.2.0a2}/src/eddsa_threshold/eddsa/keys/keypair.py +0 -0
  57. {eddsa_threshold-0.2a1 → eddsa_threshold-0.2.0a2}/src/eddsa_threshold/eddsa/util/__init__.py +0 -0
  58. {eddsa_threshold-0.2a1 → eddsa_threshold-0.2.0a2}/src/eddsa_threshold/eddsa/util/dom.py +0 -0
  59. {eddsa_threshold-0.2a1 → eddsa_threshold-0.2.0a2}/src/eddsa_threshold/eddsa/util/hash_bindings.py +0 -0
  60. {eddsa_threshold-0.2a1 → eddsa_threshold-0.2.0a2}/src/eddsa_threshold/frost/__init__.py +0 -0
  61. {eddsa_threshold-0.2a1 → eddsa_threshold-0.2.0a2}/src/eddsa_threshold/frost/coordinator.py +0 -0
  62. {eddsa_threshold-0.2a1 → eddsa_threshold-0.2.0a2}/src/eddsa_threshold/frost/core/__init__.py +0 -0
  63. {eddsa_threshold-0.2a1 → eddsa_threshold-0.2.0a2}/src/eddsa_threshold/frost/core/base/__init__.py +0 -0
  64. {eddsa_threshold-0.2a1 → eddsa_threshold-0.2.0a2}/src/eddsa_threshold/frost/core/base/frost_hashing.py +0 -0
  65. {eddsa_threshold-0.2a1 → eddsa_threshold-0.2.0a2}/src/eddsa_threshold/frost/core/ed25519/__init__.py +0 -0
  66. {eddsa_threshold-0.2a1 → eddsa_threshold-0.2.0a2}/src/eddsa_threshold/frost/core/ed25519/frost_hashing.py +0 -0
  67. {eddsa_threshold-0.2a1 → eddsa_threshold-0.2.0a2}/src/eddsa_threshold/frost/core/ed448/__init__.py +0 -0
  68. {eddsa_threshold-0.2a1 → eddsa_threshold-0.2.0a2}/src/eddsa_threshold/frost/core/ed448/frost_hashing.py +0 -0
  69. {eddsa_threshold-0.2a1 → eddsa_threshold-0.2.0a2}/src/eddsa_threshold/frost/core/frost_types.py +0 -0
  70. {eddsa_threshold-0.2a1 → eddsa_threshold-0.2.0a2}/src/eddsa_threshold/frost/core/polynomial.py +0 -0
  71. {eddsa_threshold-0.2a1 → eddsa_threshold-0.2.0a2}/src/eddsa_threshold/frost/core/secrets/__init__.py +0 -0
  72. {eddsa_threshold-0.2a1 → eddsa_threshold-0.2.0a2}/src/eddsa_threshold/frost/core/secrets/secret_sharing.py +0 -0
  73. {eddsa_threshold-0.2a1 → eddsa_threshold-0.2.0a2}/src/eddsa_threshold/frost/core/secrets/shamir_secret_sharing.py +0 -0
  74. {eddsa_threshold-0.2a1 → eddsa_threshold-0.2.0a2}/src/eddsa_threshold/frost/core/util.py +0 -0
  75. {eddsa_threshold-0.2a1 → eddsa_threshold-0.2.0a2}/src/eddsa_threshold/frost/participant.py +0 -0
  76. {eddsa_threshold-0.2a1 → eddsa_threshold-0.2.0a2}/src/eddsa_threshold/frost/trusted_dealer.py +0 -0
  77. {eddsa_threshold-0.2a1 → eddsa_threshold-0.2.0a2}/src/eddsa_threshold.egg-info/dependency_links.txt +0 -0
  78. {eddsa_threshold-0.2a1 → eddsa_threshold-0.2.0a2}/src/eddsa_threshold.egg-info/requires.txt +0 -0
  79. {eddsa_threshold-0.2a1 → eddsa_threshold-0.2.0a2}/src/eddsa_threshold.egg-info/top_level.txt +0 -0
@@ -0,0 +1,70 @@
1
+ name: Create Release
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ inputs:
6
+ version:
7
+ description: "Version (e.g. 0.2.0.alpha2, without the leading 'v')"
8
+ required: true
9
+
10
+ jobs:
11
+ release-build:
12
+ runs-on: ubuntu-latest
13
+ permissions:
14
+ contents: write
15
+ steps:
16
+ - name: Create Git tag for release
17
+ env:
18
+ VERSION: ${{ github.event.inputs.version }}
19
+ uses: actions/github-script@v9
20
+ with:
21
+ script: |
22
+ github.rest.git.createRef({
23
+ owner: context.repo.owner,
24
+ repo: context.repo.repo,
25
+ ref: "refs/tags/v${{env.VERSION}}",
26
+ sha: context.sha
27
+ })
28
+
29
+ - uses: actions/checkout@v6
30
+ with:
31
+ fetch-depth: 0
32
+ fetch-tags: true
33
+
34
+ - uses: actions/setup-python@v6
35
+ with:
36
+ python-version: "3.14"
37
+
38
+ - name: Build release distributions
39
+ run: |
40
+ python -m pip install build
41
+ python -m build
42
+
43
+ - name: Upload distributions
44
+ uses: actions/upload-artifact@v7
45
+ with:
46
+ name: release-dists
47
+ path: dist/
48
+
49
+ pypi-publish:
50
+ runs-on: ubuntu-latest
51
+ needs:
52
+ - release-build
53
+ permissions:
54
+ id-token: write
55
+
56
+ environment:
57
+ name: pypi
58
+ url: https://pypi.org/project/eddsa-threshold/
59
+
60
+ steps:
61
+ - name: Retrieve release distributions
62
+ uses: actions/download-artifact@v8
63
+ with:
64
+ name: release-dists
65
+ path: dist/
66
+
67
+ - name: Publish release distributions to PyPI
68
+ uses: pypa/gh-action-pypi-publish@release/v1
69
+ with:
70
+ packages-dir: dist/
@@ -0,0 +1,207 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ #uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ #poetry.lock
109
+ #poetry.toml
110
+
111
+ # pdm
112
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
114
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
115
+ #pdm.lock
116
+ #pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # pixi
121
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
122
+ #pixi.lock
123
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
124
+ # in the .venv directory. It is recommended not to include this directory in version control.
125
+ .pixi
126
+
127
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
128
+ __pypackages__/
129
+
130
+ # Celery stuff
131
+ celerybeat-schedule
132
+ celerybeat.pid
133
+
134
+ # SageMath parsed files
135
+ *.sage.py
136
+
137
+ # Environments
138
+ .env
139
+ .envrc
140
+ .venv
141
+ env/
142
+ venv/
143
+ ENV/
144
+ env.bak/
145
+ venv.bak/
146
+
147
+ # Spyder project settings
148
+ .spyderproject
149
+ .spyproject
150
+
151
+ # Rope project settings
152
+ .ropeproject
153
+
154
+ # mkdocs documentation
155
+ /site
156
+
157
+ # mypy
158
+ .mypy_cache/
159
+ .dmypy.json
160
+ dmypy.json
161
+
162
+ # Pyre type checker
163
+ .pyre/
164
+
165
+ # pytype static type analyzer
166
+ .pytype/
167
+
168
+ # Cython debug symbols
169
+ cython_debug/
170
+
171
+ # PyCharm
172
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
173
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
174
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
175
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
176
+ #.idea/
177
+
178
+ # Abstra
179
+ # Abstra is an AI-powered process automation framework.
180
+ # Ignore directories containing user credentials, local state, and settings.
181
+ # Learn more at https://abstra.io/docs
182
+ .abstra/
183
+
184
+ # Visual Studio Code
185
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
186
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
187
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
188
+ # you could uncomment the following to ignore the entire vscode folder
189
+ # .vscode/
190
+
191
+ # Ruff stuff:
192
+ .ruff_cache/
193
+
194
+ # PyPI configuration file
195
+ .pypirc
196
+
197
+ # Cursor
198
+ # Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
199
+ # exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
200
+ # refer to https://docs.cursor.com/context/ignore-files
201
+ .cursorignore
202
+ .cursorindexingignore
203
+
204
+ # Marimo
205
+ marimo/_static/
206
+ marimo/_lsp/
207
+ __marimo__/
@@ -0,0 +1,15 @@
1
+ {
2
+ "python.testing.pytestArgs": [
3
+ "--capture=tee-sys",
4
+ "test"
5
+ ],
6
+ "python.testing.unittestEnabled": false,
7
+ "python.testing.pytestEnabled": true,
8
+ "python-envs.pythonProjects": [
9
+ {
10
+ "path": ".",
11
+ "envManager": "ms-python.python:system",
12
+ "packageManager": "ms-python.python:pip"
13
+ }
14
+ ]
15
+ }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: eddsa-threshold
3
- Version: 0.2a1
3
+ Version: 0.2.0a2
4
4
  Summary: Educational EdDSA and FROST implementations
5
5
  Author-email: Maximilian <23641084+xfallme@users.noreply.github.com>
6
6
  License-Expression: 0BSD
@@ -1,10 +1,11 @@
1
1
  [build-system]
2
- requires = ["setuptools>=64"]
2
+ requires = ["setuptools>=80", "setuptools-scm[simple]>=9.2"]
3
3
  build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "eddsa-threshold"
7
- version = "0.2alpha1"
7
+ # last manual version = "v0.2.0.alpha1"
8
+ dynamic = ["version"]
8
9
  authors = [
9
10
  { name = "Maximilian", email = "23641084+xfallme@users.noreply.github.com" },
10
11
  ]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: eddsa-threshold
3
- Version: 0.2a1
3
+ Version: 0.2.0a2
4
4
  Summary: Educational EdDSA and FROST implementations
5
5
  Author-email: Maximilian <23641084+xfallme@users.noreply.github.com>
6
6
  License-Expression: 0BSD
@@ -1,7 +1,10 @@
1
+ .gitignore
1
2
  LICENSE
2
3
  MANIFEST.in
3
4
  README.md
4
5
  pyproject.toml
6
+ .github/workflows/release.yaml
7
+ .vscode/settings.json
5
8
  src/eddsa_threshold/__init__.py
6
9
  src/eddsa_threshold.egg-info/PKG-INFO
7
10
  src/eddsa_threshold.egg-info/SOURCES.txt
@@ -56,4 +59,19 @@ src/eddsa_threshold/frost/core/ed448/__init__.py
56
59
  src/eddsa_threshold/frost/core/ed448/frost_hashing.py
57
60
  src/eddsa_threshold/frost/core/secrets/__init__.py
58
61
  src/eddsa_threshold/frost/core/secrets/secret_sharing.py
59
- src/eddsa_threshold/frost/core/secrets/shamir_secret_sharing.py
62
+ src/eddsa_threshold/frost/core/secrets/shamir_secret_sharing.py
63
+ test/eddsa/test_cases_curves.py
64
+ test/eddsa/test_cases_eddsa_vectors.py
65
+ test/eddsa/test_cases_fields.py
66
+ test/eddsa/test_ed25519.py
67
+ test/eddsa/test_ed448.py
68
+ test/eddsa/test_field_arithmetic.py
69
+ test/eddsa/test_keypair_generation.py
70
+ test/eddsa/test_point_arithmetic.py
71
+ test/eddsa/test_point_conversion.py
72
+ test/eddsa/test_point_encoding.py
73
+ test/frost/test_cases_scalars.py
74
+ test/frost/test_cases_simple_frost.py
75
+ test/frost/test_polynomial.py
76
+ test/frost/test_shamir_secret_sharing.py
77
+ test/frost/test_simple_frost.py
@@ -0,0 +1,19 @@
1
+ from typing import Tuple
2
+
3
+ from eddsa_threshold.eddsa.curves.base.edwards_curve import EdwardsCurve
4
+
5
+
6
+ def case_ed25519() -> Tuple[EdwardsCurve, object]:
7
+ """Inputs for ed25519 curve tests"""
8
+ import eddsa_threshold.eddsa.curves.ed25519.ed25519_curve as ed25519
9
+ import eddsa_threshold.eddsa.curves.ed25519.constants as ed25519_constants
10
+
11
+ return ed25519.Ed25519Curve(), ed25519_constants
12
+
13
+
14
+ def case_ed448() -> Tuple[EdwardsCurve, object]:
15
+ """Inputs for ed448 curve tests"""
16
+ import eddsa_threshold.eddsa.curves.ed448.ed448_curve as ed448
17
+ import eddsa_threshold.eddsa.curves.ed448.constants as ed448_constants
18
+
19
+ return ed448.Ed448Curve(), ed448_constants
@@ -0,0 +1,109 @@
1
+ from urllib.request import urlopen, Request
2
+ from pathlib import Path
3
+
4
+
5
+ def case_ed25519_test_vectors_cr_yp_to() -> list[str]:
6
+ # Use http://ed25519.cr.yp.to/python/sign.input as input
7
+ cache_dir = Path(__file__).resolve().parent / "downloads"
8
+ cache_dir.mkdir(parents=True, exist_ok=True)
9
+ cache_file = cache_dir / "sign.input"
10
+
11
+ if not cache_file.exists():
12
+ url = "http://ed25519.cr.yp.to/python/sign.input"
13
+ req = Request(url)
14
+ with urlopen(req) as resp:
15
+ content = resp.read().decode("ascii")
16
+ cache_file.write_text(content, encoding="ascii")
17
+ else:
18
+ content = cache_file.read_text(encoding="ascii")
19
+
20
+ # sk, pk, m, sm
21
+ lines = [ln for ln in content.splitlines() if ln and not ln.startswith("#")]
22
+
23
+ return lines
24
+
25
+
26
+ def case_ed25519_test_vectors_rfc8032() -> list[str]:
27
+ """Manually defined test vectors from RFC 8032, 7.1"""
28
+ lines = [
29
+ # Would be Secret Key:Public Key:Message:Signature, manually concatenated signature+message at the end for compatibility with cr.yp.to format
30
+ # TEST 1
31
+ "9d61b19deffd5a60ba844af492ec2cc44449c5697b326919703bac031cae7f60:d75a980182b10ab7d54bfed3c964073a0ee172f3daa62325af021a68f707511a::e5564300c360ac729086e2cc806e828a84877f1eb8e5d974d873e065224901555fb8821590a33bacc61e39701cf9b46bd25bf5f0595bbe24655141438e7a100b",
32
+ # TEST 2
33
+ "4ccd089b28ff96da9db6c346ec114e0f5b8a319f35aba624da8cf6ed4fb8a6fb:3d4017c3e843895a92b70aa74d1b7ebc9c982ccf2ec4968cc0cd55f12af4660c:72:92a009a9f0d4cab8720e820b5f642540a2b27b5416503f8fb3762223ebdb69da085ac1e43e15996e458f3613d0f11d8c387b2eaeb4302aeeb00d291612bb0c0072",
34
+ # TEST 3
35
+ "c5aa8df43f9f837bedb7442f31dcb7b166d38535076f094b85ce3a2e0b4458f7:fc51cd8e6218a1a38da47ed00230f0580816ed13ba3303ac5deb911548908025:af82:6291d657deec24024827e69c3abe01a30ce548a284743a445e3680d7db5ac3ac18ff9b538d16f290ae67f760984dc6594a7c15e9716ed28dc027beceea1ec40aaf82",
36
+ # TEST 1024
37
+ "f5e5767cf153319517630f226876b86c8160cc583bc013744c6bf255f5cc0ee5:278117fc144c72340f67d0f2316e8386ceffbf2b2428c9c51fef7c597f1d426e:08b8b2b733424243760fe426a4b54908632110a66c2f6591eabd3345e3e4eb98fa6e264bf09efe12ee50f8f54e9f77b1e355f6c50544e23fb1433ddf73be84d879de7c0046dc4996d9e773f4bc9efe5738829adb26c81b37c93a1b270b20329d658675fc6ea534e0810a4432826bf58c941efb65d57a338bbd2e26640f89ffbc1a858efcb8550ee3a5e1998bd177e93a7363c344fe6b199ee5d02e82d522c4feba15452f80288a821a579116ec6dad2b3b310da903401aa62100ab5d1a36553e06203b33890cc9b832f79ef80560ccb9a39ce767967ed628c6ad573cb116dbefefd75499da96bd68a8a97b928a8bbc103b6621fcde2beca1231d206be6cd9ec7aff6f6c94fcd7204ed3455c68c83f4a41da4af2b74ef5c53f1d8ac70bdcb7ed185ce81bd84359d44254d95629e9855a94a7c1958d1f8ada5d0532ed8a5aa3fb2d17ba70eb6248e594e1a2297acbbb39d502f1a8c6eb6f1ce22b3de1a1f40cc24554119a831a9aad6079cad88425de6bde1a9187ebb6092cf67bf2b13fd65f27088d78b7e883c8759d2c4f5c65adb7553878ad575f9fad878e80a0c9ba63bcbcc2732e69485bbc9c90bfbd62481d9089beccf80cfe2df16a2cf65bd92dd597b0707e0917af48bbb75fed413d238f5555a7a569d80c3414a8d0859dc65a46128bab27af87a71314f318c782b23ebfe808b82b0ce26401d2e22f04d83d1255dc51addd3b75a2b1ae0784504df543af8969be3ea7082ff7fc9888c144da2af58429ec96031dbcad3dad9af0dcbaaaf268cb8fcffead94f3c7ca495e056a9b47acdb751fb73e666c6c655ade8297297d07ad1ba5e43f1bca32301651339e22904cc8c42f58c30c04aafdb038dda0847dd988dcda6f3bfd15c4b4c4525004aa06eeff8ca61783aacec57fb3d1f92b0fe2fd1a85f6724517b65e614ad6808d6f6ee34dff7310fdc82aebfd904b01e1dc54b2927094b2db68d6f903b68401adebf5a7e08d78ff4ef5d63653a65040cf9bfd4aca7984a74d37145986780fc0b16ac451649de6188a7dbdf191f64b5fc5e2ab47b57f7f7276cd419c17a3ca8e1b939ae49e488acba6b965610b5480109c8b17b80e1b7b750dfc7598d5d5011fd2dcc5600a32ef5b52a1ecc820e308aa342721aac0943bf6686b64b2579376504ccc493d97e6aed3fb0f9cd71a43dd497f01f17c0e2cb3797aa2a2f256656168e6c496afc5fb93246f6b1116398a346f1a641f3b041e989f7914f90cc2c7fff357876e506b50d334ba77c225bc307ba537152f3f1610e4eafe595f6d9d90d11faa933a15ef1369546868a7f3a45a96768d40fd9d03412c091c6315cf4fde7cb68606937380db2eaaa707b4c4185c32eddcdd306705e4dc1ffc872eeee475a64dfac86aba41c0618983f8741c5ef68d3a101e8a3b8cac60c905c15fc910840b94c00a0b9d0:0aab4c900501b3e24d7cdf4663326a3a87df5e4843b2cbdb67cbf6e460fec350aa5371b1508f9f4528ecea23c436d94b5e8fcd4f681e30a6ac00a9704a188a0308b8b2b733424243760fe426a4b54908632110a66c2f6591eabd3345e3e4eb98fa6e264bf09efe12ee50f8f54e9f77b1e355f6c50544e23fb1433ddf73be84d879de7c0046dc4996d9e773f4bc9efe5738829adb26c81b37c93a1b270b20329d658675fc6ea534e0810a4432826bf58c941efb65d57a338bbd2e26640f89ffbc1a858efcb8550ee3a5e1998bd177e93a7363c344fe6b199ee5d02e82d522c4feba15452f80288a821a579116ec6dad2b3b310da903401aa62100ab5d1a36553e06203b33890cc9b832f79ef80560ccb9a39ce767967ed628c6ad573cb116dbefefd75499da96bd68a8a97b928a8bbc103b6621fcde2beca1231d206be6cd9ec7aff6f6c94fcd7204ed3455c68c83f4a41da4af2b74ef5c53f1d8ac70bdcb7ed185ce81bd84359d44254d95629e9855a94a7c1958d1f8ada5d0532ed8a5aa3fb2d17ba70eb6248e594e1a2297acbbb39d502f1a8c6eb6f1ce22b3de1a1f40cc24554119a831a9aad6079cad88425de6bde1a9187ebb6092cf67bf2b13fd65f27088d78b7e883c8759d2c4f5c65adb7553878ad575f9fad878e80a0c9ba63bcbcc2732e69485bbc9c90bfbd62481d9089beccf80cfe2df16a2cf65bd92dd597b0707e0917af48bbb75fed413d238f5555a7a569d80c3414a8d0859dc65a46128bab27af87a71314f318c782b23ebfe808b82b0ce26401d2e22f04d83d1255dc51addd3b75a2b1ae0784504df543af8969be3ea7082ff7fc9888c144da2af58429ec96031dbcad3dad9af0dcbaaaf268cb8fcffead94f3c7ca495e056a9b47acdb751fb73e666c6c655ade8297297d07ad1ba5e43f1bca32301651339e22904cc8c42f58c30c04aafdb038dda0847dd988dcda6f3bfd15c4b4c4525004aa06eeff8ca61783aacec57fb3d1f92b0fe2fd1a85f6724517b65e614ad6808d6f6ee34dff7310fdc82aebfd904b01e1dc54b2927094b2db68d6f903b68401adebf5a7e08d78ff4ef5d63653a65040cf9bfd4aca7984a74d37145986780fc0b16ac451649de6188a7dbdf191f64b5fc5e2ab47b57f7f7276cd419c17a3ca8e1b939ae49e488acba6b965610b5480109c8b17b80e1b7b750dfc7598d5d5011fd2dcc5600a32ef5b52a1ecc820e308aa342721aac0943bf6686b64b2579376504ccc493d97e6aed3fb0f9cd71a43dd497f01f17c0e2cb3797aa2a2f256656168e6c496afc5fb93246f6b1116398a346f1a641f3b041e989f7914f90cc2c7fff357876e506b50d334ba77c225bc307ba537152f3f1610e4eafe595f6d9d90d11faa933a15ef1369546868a7f3a45a96768d40fd9d03412c091c6315cf4fde7cb68606937380db2eaaa707b4c4185c32eddcdd306705e4dc1ffc872eeee475a64dfac86aba41c0618983f8741c5ef68d3a101e8a3b8cac60c905c15fc910840b94c00a0b9d0",
38
+ # TEST SHA(abc)
39
+ "833fe62409237b9d62ec77587520911e9a759cec1d19755b7da901b96dca3d42:ec172b93ad5e563bf4932c70e1245034c35467ef2efd4d64ebf819683467e2bf:ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f:dc2a4459e7369633a52b1bf277839a00201009a3efbf3ecb69bea2186c26b58909351fc9ac90b3ecfdfbc7c66431e0303dca179c138ac17ad9bef1177331a704ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f"
40
+ ]
41
+
42
+ return lines
43
+
44
+
45
+ def case_ed25519ctx_test_vectors_rfc8032() -> list[str]:
46
+ """Manually defined test vectors from RFC 8032, 7.2"""
47
+ lines = [
48
+ # Secret Key:Public Key:Message:Context:Signature
49
+ # foo
50
+ "0305334e381af78f141cb666f6199f57bc3495335a256a95bd2a55bf546663f6:dfc9425e4f968f7f0c29f0259cf5f9aed6851c2bb4ad8bfb860cfee0ab248292:f726936d19c800494e3fdaff20b276a8:666f6f:55a4cc2f70a54e04288c5f4cd1e45a7bb520b36292911876cada7323198dd87a8b36950b95130022907a7fb7c4e9b2d5f6cca685a587b4b21f4b888e4e7edb0d",
51
+ # bar
52
+ "0305334e381af78f141cb666f6199f57bc3495335a256a95bd2a55bf546663f6:dfc9425e4f968f7f0c29f0259cf5f9aed6851c2bb4ad8bfb860cfee0ab248292:f726936d19c800494e3fdaff20b276a8:626172:fc60d5872fc46b3aa69f8b5b4351d5808f92bcc044606db097abab6dbcb1aee3216c48e8b3b66431b5b186d1d28f8ee15a5ca2df6668346291c2043d4eb3e90d",
53
+ # foo2
54
+ "0305334e381af78f141cb666f6199f57bc3495335a256a95bd2a55bf546663f6:dfc9425e4f968f7f0c29f0259cf5f9aed6851c2bb4ad8bfb860cfee0ab248292:508e9e6882b979fea900f62adceaca35:666f6f:8b70c1cc8310e1de20ac53ce28ae6e7207f33c3295e03bb5c0732a1d20dc64908922a8b052cf99b7c4fe107a5abb5b2c4085ae75890d02df26269d8945f84b0b",
55
+ # foo3
56
+ "ab9c2853ce297ddab85c993b3ae14bcad39b2c682beabc27d6d4eb20711d6560:0f1d1274943b91415889152e893d80e93275a1fc0b65fd71b4b0dda10ad7d772:f726936d19c800494e3fdaff20b276a8:666f6f:21655b5f1aa965996b3f97b3c849eafba922a0a62992f73b3d1b73106a84ad85e9b86a7b6005ea868337ff2d20a7f5fbd4cd10b0be49a68da2b2e0dc0ad8960f"
57
+ ]
58
+
59
+ return lines
60
+
61
+
62
+ def case_ed25519ph_test_vectors_rfc8032() -> list[str]:
63
+ """Manually defined test vectors from RFC 8032, 7.3"""
64
+ lines = [
65
+ # Secret Key:Public Key:Message:Context:Signature
66
+ # abc
67
+ "833fe62409237b9d62ec77587520911e9a759cec1d19755b7da901b96dca3d42:ec172b93ad5e563bf4932c70e1245034c35467ef2efd4d64ebf819683467e2bf:616263::98a70222f0b8121aa9d30f813d683f809e462b469c7ff87639499bb94e6dae4131f85042463c2a355a2003d062adf5aaa10b8c61e636062aaad11c2a26083406"
68
+ ]
69
+
70
+ return lines
71
+
72
+
73
+ def case_ed448_test_vectors_rfc8032() -> list[str]:
74
+ """Manually defined test vectors from RFC 8032, 7.4"""
75
+ lines = [
76
+ # Secret Key:Public Key:Message:Context:Signature
77
+ # Blank
78
+ "6c82a562cb808d10d632be89c8513ebf6c929f34ddfa8c9f63c9960ef6e348a3528c8a3fcc2f044e39a3fc5b94492f8f032e7549a20098f95b:5fd7449b59b461fd2ce787ec616ad46a1da1342485a70e1f8a0ea75d80e96778edf124769b46c7061bd6783df1e50f6cd1fa1abeafe8256180:::533a37f6bbe457251f023c0d88f976ae2dfb504a843e34d2074fd823d41a591f2b233f034f628281f2fd7a22ddd47d7828c59bd0a21bfd3980ff0d2028d4b18a9df63e006c5d1c2d345b925d8dc00b4104852db99ac5c7cdda8530a113a0f4dbb61149f05a7363268c71d95808ff2e652600",
79
+ # 1 octet
80
+ "c4eab05d357007c632f3dbb48489924d552b08fe0c353a0d4a1f00acda2c463afbea67c5e8d2877c5e3bc397a659949ef8021e954e0a12274e:43ba28f430cdff456ae531545f7ecd0ac834a55d9358c0372bfa0c6c6798c0866aea01eb00742802b8438ea4cb82169c235160627b4c3a9480:03::26b8f91727bd62897af15e41eb43c377efb9c610d48f2335cb0bd0087810f4352541b143c4b981b7e18f62de8ccdf633fc1bf037ab7cd779805e0dbcc0aae1cbcee1afb2e027df36bc04dcecbf154336c19f0af7e0a6472905e799f1953d2a0ff3348ab21aa4adafd1d234441cf807c03a00",
81
+ # 1 octet (with context)
82
+ "c4eab05d357007c632f3dbb48489924d552b08fe0c353a0d4a1f00acda2c463afbea67c5e8d2877c5e3bc397a659949ef8021e954e0a12274e:43ba28f430cdff456ae531545f7ecd0ac834a55d9358c0372bfa0c6c6798c0866aea01eb00742802b8438ea4cb82169c235160627b4c3a9480:03:666f6f:d4f8f6131770dd46f40867d6fd5d5055de43541f8c5e35abbcd001b32a89f7d2151f7647f11d8ca2ae279fb842d607217fce6e042f6815ea000c85741de5c8da1144a6a1aba7f96de42505d7a7298524fda538fccbbb754f578c1cad10d54d0d5428407e85dcbc98a49155c13764e66c3c00",
83
+ # 11 octets
84
+ "cd23d24f714274e744343237b93290f511f6425f98e64459ff203e8985083ffdf60500553abc0e05cd02184bdb89c4ccd67e187951267eb328:dcea9e78f35a1bf3499a831b10b86c90aac01cd84b67a0109b55a36e9328b1e365fce161d71ce7131a543ea4cb5f7e9f1d8b00696447001400:0c3e544074ec63b0265e0c::1f0a8888ce25e8d458a21130879b840a9089d999aaba039eaf3e3afa090a09d389dba82c4ff2ae8ac5cdfb7c55e94d5d961a29fe0109941e00b8dbdeea6d3b051068df7254c0cdc129cbe62db2dc957dbb47b51fd3f213fb8698f064774250a5028961c9bf8ffd973fe5d5c206492b140e00",
85
+ # 12 octets
86
+ "258cdd4ada32ed9c9ff54e63756ae582fb8fab2ac721f2c8e676a72768513d939f63dddb55609133f29adf86ec9929dccb52c1c5fd2ff7e21b:3ba16da0c6f2cc1f30187740756f5e798d6bc5fc015d7c63cc9510ee3fd44adc24d8e968b6e46e6f94d19b945361726bd75e149ef09817f580:64a65f3cdedcdd66811e2915::7eeeab7c4e50fb799b418ee5e3197ff6bf15d43a14c34389b59dd1a7b1b85b4ae90438aca634bea45e3a2695f1270f07fdcdf7c62b8efeaf00b45c2c96ba457eb1a8bf075a3db28e5c24f6b923ed4ad747c3c9e03c7079efb87cb110d3a99861e72003cbae6d6b8b827e4e6c143064ff3c00",
87
+ # 13 octets
88
+ "7ef4e84544236752fbb56b8f31a23a10e42814f5f55ca037cdcc11c64c9a3b2949c1bb60700314611732a6c2fea98eebc0266a11a93970100e:b3da079b0aa493a5772029f0467baebee5a8112d9d3a22532361da294f7bb3815c5dc59e176b4d9f381ca0938e13c6c07b174be65dfa578e80:64a65f3cdedcdd66811e2915e7::6a12066f55331b6c22acd5d5bfc5d71228fbda80ae8dec26bdd306743c5027cb4890810c162c027468675ecf645a83176c0d7323a2ccde2d80efe5a1268e8aca1d6fbc194d3f77c44986eb4ab4177919ad8bec33eb47bbb5fc6e28196fd1caf56b4e7e0ba5519234d047155ac727a1053100",
89
+ # 64 octets
90
+ "d65df341ad13e008567688baedda8e9dcdc17dc024974ea5b4227b6530e339bff21f99e68ca6968f3cca6dfe0fb9f4fab4fa135d5542ea3f01:df9705f58edbab802c7f8363cfe5560ab1c6132c20a9f1dd163483a26f8ac53a39d6808bf4a1dfbd261b099bb03b3fb50906cb28bd8a081f00:bd0f6a3747cd561bdddf4640a332461a4a30a12a434cd0bf40d766d9c6d458e5512204a30c17d1f50b5079631f64eb3112182da3005835461113718d1a5ef944::554bc2480860b49eab8532d2a533b7d578ef473eeb58c98bb2d0e1ce488a98b18dfde9b9b90775e67f47d4a1c3482058efc9f40d2ca033a0801b63d45b3b722ef552bad3b4ccb667da350192b61c508cf7b6b5adadc2c8d9a446ef003fb05cba5f30e88e36ec2703b349ca229c2670833900",
91
+ # 256 octets
92
+ "2ec5fe3c17045abdb136a5e6a913e32ab75ae68b53d2fc149b77e504132d37569b7e766ba74a19bd6162343a21c8590aa9cebca9014c636df5:79756f014dcfe2079f5dd9e718be4171e2ef2486a08f25186f6bff43a9936b9bfe12402b08ae65798a3d81e22e9ec80e7690862ef3d4ed3a00:15777532b0bdd0d1389f636c5f6b9ba734c90af572877e2d272dd078aa1e567cfa80e12928bb542330e8409f3174504107ecd5efac61ae7504dabe2a602ede89e5cca6257a7c77e27a702b3ae39fc769fc54f2395ae6a1178cab4738e543072fc1c177fe71e92e25bf03e4ecb72f47b64d0465aaea4c7fad372536c8ba516a6039c3c2a39f0e4d832be432dfa9a706a6e5c7e19f397964ca4258002f7c0541b590316dbc5622b6b2a6fe7a4abffd96105eca76ea7b98816af0748c10df048ce012d901015a51f189f3888145c03650aa23ce894c3bd889e030d565071c59f409a9981b51878fd6fc110624dcbcde0bf7a69ccce38fabdf86f3bef6044819de11::c650ddbb0601c19ca11439e1640dd931f43c518ea5bea70d3dcde5f4191fe53f00cf966546b72bcc7d58be2b9badef28743954e3a44a23f880e8d4f1cfce2d7a61452d26da05896f0a50da66a239a8a188b6d825b3305ad77b73fbac0836ecc60987fd08527c1a8e80d5823e65cafe2a3d00",
93
+ # 1023 octets
94
+ "872d093780f5d3730df7c212664b37b8a0f24f56810daa8382cd4fa3f77634ec44dc54f1c2ed9bea86fafb7632d8be199ea165f5ad55dd9ce8:a81b2e8a70a5ac94ffdbcc9badfc3feb0801f258578bb114ad44ece1ec0e799da08effb81c5d685c0c56f64eecaef8cdf11cc38737838cf400:6ddf802e1aae4986935f7f981ba3f0351d6273c0a0c22c9c0e8339168e675412a3debfaf435ed651558007db4384b650fcc07e3b586a27a4f7a00ac8a6fec2cd86ae4bf1570c41e6a40c931db27b2faa15a8cedd52cff7362c4e6e23daec0fbc3a79b6806e316efcc7b68119bf46bc76a26067a53f296dafdbdc11c77f7777e972660cf4b6a9b369a6665f02e0cc9b6edfad136b4fabe723d2813db3136cfde9b6d044322fee2947952e031b73ab5c603349b307bdc27bc6cb8b8bbd7bd323219b8033a581b59eadebb09b3c4f3d2277d4f0343624acc817804728b25ab797172b4c5c21a22f9c7839d64300232eb66e53f31c723fa37fe387c7d3e50bdf9813a30e5bb12cf4cd930c40cfb4e1fc622592a49588794494d56d24ea4b40c89fc0596cc9ebb961c8cb10adde976a5d602b1c3f85b9b9a001ed3c6a4d3b1437f52096cd1956d042a597d561a596ecd3d1735a8d570ea0ec27225a2c4aaff26306d1526c1af3ca6d9cf5a2c98f47e1c46db9a33234cfd4d81f2c98538a09ebe76998d0d8fd25997c7d255c6d66ece6fa56f11144950f027795e653008f4bd7ca2dee85d8e90f3dc315130ce2a00375a318c7c3d97be2c8ce5b6db41a6254ff264fa6155baee3b0773c0f497c573f19bb4f4240281f0b1f4f7be857a4e59d416c06b4c50fa09e1810ddc6b1467baeac5a3668d11b6ecaa901440016f389f80acc4db977025e7f5924388c7e340a732e554440e76570f8dd71b7d640b3450d1fd5f0410a18f9a3494f707c717b79b4bf75c98400b096b21653b5d217cf3565c9597456f70703497a078763829bc01bb1cbc8fa04eadc9a6e3f6699587a9e75c94e5bab0036e0b2e711392cff0047d0d6b05bd2a588bc109718954259f1d86678a579a3120f19cfb2963f177aeb70f2d4844826262e51b80271272068ef5b3856fa8535aa2a88b2d41f2a0e2fda7624c2850272ac4a2f561f8f2f7a318bfd5caf9696149e4ac824ad3460538fdc25421beec2cc6818162d06bbed0c40a387192349db67a118bada6cd5ab0140ee273204f628aad1c135f770279a651e24d8c14d75a6059d76b96a6fd857def5e0b354b27ab937a5815d16b5fae407ff18222c6d1ed263be68c95f32d908bd895cd76207ae726487567f9a67dad79abec316f683b17f2d02bf07e0ac8b5bc6162cf94697b3c27cd1fea49b27f23ba2901871962506520c392da8b6ad0d99f7013fbc06c2c17a569500c8a7696481c1cd33e9b14e40b82e79a5f5db82571ba97bae3ad3e0479515bb0e2b0f3bfcd1fd33034efc6245eddd7ee2086ddae2600d8ca73e214e8c2b0bdb2b047c6a464a562ed77b73d2d841c4b34973551257713b753632efba348169abc90a68f42611a40126d7cb21b58695568186f7e569d2ff0f9e745d0487dd2eb997cafc5abf9dd102e62ff66cba87::e301345a41a39a4d72fff8df69c98075a0cc082b802fc9b2b6bc503f926b65bddf7f4c8f1cb49f6396afc8a70abe6d8aef0db478d4c6b2970076c6a0484fe76d76b3a97625d79f1ce240e7c576750d295528286f719b413de9ada3e8eb78ed573603ce30d8bb761785dc30dbc320869e1a00"
95
+ ]
96
+
97
+ return lines
98
+
99
+
100
+ def case_ed448ph_test_vectors_rfc8032() -> list[str]:
101
+ """Manually defined test vectors from RFC 8032, 7.5"""
102
+ lines = [
103
+ # TEST abc
104
+ "833fe62409237b9d62ec77587520911e9a759cec1d19755b7da901b96dca3d42ef7822e0d5104127dc05d6dbefde69e3ab2cec7c867c6e2c49:259b71c19f83ef77a7abd26524cbdb3161b590a48f7d17de3ee0ba9c52beb743c09428a131d6b1b57303d90d8132c276d5ed3d5d01c0f53880:616263::822f6901f7480f3d5f562c592994d9693602875614483256505600bbc281ae381f54d6bce2ea911574932f52a4e6cadd78769375ec3ffd1b801a0d9b3f4030cd433964b6457ea39476511214f97469b57dd32dbc560a9a94d00bff07620464a3ad203df7dc7ce360c3cd3696d9d9fab90f00",
105
+ # TEST abc (with context)
106
+ "833fe62409237b9d62ec77587520911e9a759cec1d19755b7da901b96dca3d42ef7822e0d5104127dc05d6dbefde69e3ab2cec7c867c6e2c49:259b71c19f83ef77a7abd26524cbdb3161b590a48f7d17de3ee0ba9c52beb743c09428a131d6b1b57303d90d8132c276d5ed3d5d01c0f53880:616263:666f6f:c32299d46ec8ff02b54540982814dce9a05812f81962b649d528095916a2aa481065b1580423ef927ecf0af5888f90da0f6a9a85ad5dc3f280d91224ba9911a3653d00e484e2ce232521481c8658df304bb7745a73514cdb9bf3e15784ab71284f8d0704a608c54a6b62d97beb511d132100"
107
+ ]
108
+
109
+ return lines
@@ -0,0 +1,15 @@
1
+ from eddsa_threshold.eddsa.curves.base.field_ops import FieldOps
2
+
3
+
4
+ def case_ed25519() -> FieldOps:
5
+ """Inputs for ed25519 field_ops tests"""
6
+ import eddsa_threshold.eddsa.curves.ed25519.field_ops as ed25519
7
+
8
+ return ed25519.Ed25519FieldOps()
9
+
10
+
11
+ def case_ed448() -> FieldOps:
12
+ """Inputs for ed448 field_ops tests"""
13
+ import eddsa_threshold.eddsa.curves.ed448.field_ops as ed448
14
+
15
+ return ed448.Ed448FieldOps()
@@ -0,0 +1,80 @@
1
+ import binascii
2
+ import pytest
3
+ from eddsa_threshold.eddsa.algorithms.ed25519 import Ed25519
4
+ from eddsa_threshold.eddsa.algorithms.ed25519ctx import Ed25519CTX
5
+ from eddsa_threshold.eddsa.algorithms.ed25519ph import Ed25519PH
6
+ from eddsa_threshold.eddsa.keys.ed25519_keypair import Ed25519Keypair
7
+ from test_cases_eddsa_vectors import *
8
+
9
+
10
+ @pytest.mark.parametrize("lines", [case_ed25519_test_vectors_cr_yp_to(), case_ed25519_test_vectors_rfc8032()], ids=["Ed25519 cr.yp.to", "Ed25519 RFC8032"])
11
+ def test_ed25519_signature(lines, request):
12
+ print(f"Running with {len(lines)} inputs for test '{request.node.callspec.id}'")
13
+
14
+ for line in lines:
15
+ x = line.split(':')
16
+
17
+ # First 64 hex chars are the secret key, the rest is the public key
18
+ sk = binascii.unhexlify(x[0][0:64])
19
+ keypair = Ed25519Keypair.from_private_bytes(sk)
20
+
21
+ m = binascii.unhexlify(x[2])
22
+ sm = binascii.unhexlify(x[3])
23
+
24
+ # Sign the message
25
+ s = Ed25519.sign(m, keypair)
26
+ assert (s+m) == sm, "Generated signature does not match expected signature"
27
+
28
+ # Verify the signature
29
+ is_valid = Ed25519.verify(s, m, keypair.public_bytes)
30
+ assert is_valid, "Signature verification failed"
31
+
32
+
33
+ @pytest.mark.parametrize("lines", [case_ed25519ctx_test_vectors_rfc8032()], ids=["Ed25519CTX RFC8032"])
34
+ def test_ed25519ctx_signature(lines, request):
35
+ print(f"Running with {len(lines)} inputs for test '{request.node.callspec.id}'")
36
+
37
+ for line in lines:
38
+ x = line.split(':')
39
+
40
+ sk = binascii.unhexlify(x[0])
41
+ keypair = Ed25519Keypair.from_private_bytes(sk)
42
+ pk = binascii.unhexlify(x[1])
43
+ assert keypair.public_bytes == pk, "Derived public key does not match expected public key"
44
+
45
+ m = binascii.unhexlify(x[2])
46
+ ctx = binascii.unhexlify(x[3])
47
+ s = binascii.unhexlify(x[4])
48
+
49
+ # Sign the message
50
+ generated_s = Ed25519CTX.sign(m, keypair, ctx)
51
+ assert generated_s == s, "Generated signature does not match expected signature"
52
+
53
+ # Verify the signature
54
+ is_valid = Ed25519CTX.verify(s, m, keypair.public_bytes, ctx)
55
+ assert is_valid, "Signature verification failed"
56
+
57
+
58
+ @pytest.mark.parametrize("lines", [case_ed25519ph_test_vectors_rfc8032()], ids=["Ed25519PH RFC8032"])
59
+ def test_ed25519ph_signature(lines, request):
60
+ print(f"Running with {len(lines)} inputs for test '{request.node.callspec.id}'")
61
+
62
+ for line in lines:
63
+ x = line.split(':')
64
+
65
+ sk = binascii.unhexlify(x[0])
66
+ keypair = Ed25519Keypair.from_private_bytes(sk)
67
+ pk = binascii.unhexlify(x[1])
68
+ assert keypair.public_bytes == pk, "Derived public key does not match expected public key"
69
+
70
+ m = binascii.unhexlify(x[2])
71
+ ctx = binascii.unhexlify(x[3])
72
+ s = binascii.unhexlify(x[4])
73
+
74
+ # Sign the message
75
+ generated_s = Ed25519PH.sign(m, keypair, ctx)
76
+ assert generated_s == s, "Generated signature does not match expected signature"
77
+
78
+ # Verify the signature
79
+ is_valid = Ed25519PH.verify(s, m, keypair.public_bytes, ctx)
80
+ assert is_valid, "Signature verification failed"
@@ -0,0 +1,57 @@
1
+ import binascii
2
+ import pytest
3
+
4
+ from eddsa_threshold.eddsa.algorithms.ed448 import Ed448
5
+ from eddsa_threshold.eddsa.algorithms.ed448ph import Ed448PH
6
+ from eddsa_threshold.eddsa.keys.ed448_keypair import Ed448Keypair
7
+ from test_cases_eddsa_vectors import *
8
+
9
+
10
+ @pytest.mark.parametrize("lines", [case_ed448_test_vectors_rfc8032()], ids=["Ed448 RFC8032"])
11
+ def test_ed448_signature(lines, request):
12
+ print(f"Running with {len(lines)} inputs for test '{request.node.callspec.id}'")
13
+
14
+ for line in lines:
15
+ x = line.split(':')
16
+
17
+ sk = binascii.unhexlify(x[0])
18
+ keypair = Ed448Keypair.from_private_bytes(sk)
19
+ pk = binascii.unhexlify(x[1])
20
+ assert keypair.public_bytes == pk, "Derived public key does not match expected public key"
21
+
22
+ m = binascii.unhexlify(x[2])
23
+ ctx = binascii.unhexlify(x[3])
24
+ s = binascii.unhexlify(x[4])
25
+
26
+ # Sign the message
27
+ generated_s = Ed448.sign(m, keypair, ctx)
28
+ assert generated_s == s, "Generated signature does not match expected signature"
29
+
30
+ # Verify the signature
31
+ is_valid = Ed448.verify(s, m, keypair.public_bytes, ctx)
32
+ assert is_valid, "Signature verification failed"
33
+
34
+
35
+ @pytest.mark.parametrize("lines", [case_ed448ph_test_vectors_rfc8032()], ids=["Ed448PH RFC8032"])
36
+ def test_ed448ph_signature(lines, request):
37
+ print(f"Running with {len(lines)} inputs for test '{request.node.callspec.id}'")
38
+
39
+ for line in lines:
40
+ x = line.split(':')
41
+
42
+ sk = binascii.unhexlify(x[0])
43
+ keypair = Ed448Keypair.from_private_bytes(sk)
44
+ pk = binascii.unhexlify(x[1])
45
+ assert keypair.public_bytes == pk, "Derived public key does not match expected public key"
46
+
47
+ m = binascii.unhexlify(x[2])
48
+ ctx = binascii.unhexlify(x[3])
49
+ s = binascii.unhexlify(x[4])
50
+
51
+ # Sign the message
52
+ generated_s = Ed448PH.sign(m, keypair, ctx)
53
+ assert generated_s == s, "Generated signature does not match expected signature"
54
+
55
+ # Verify the signature
56
+ is_valid = Ed448PH.verify(s, m, keypair.public_bytes, ctx)
57
+ assert is_valid, "Signature verification failed"