pykyber 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.
- pykyber-0.1.0/.github/workflows/CI.yml +185 -0
- pykyber-0.1.0/.gitignore +6 -0
- pykyber-0.1.0/Cargo.lock +256 -0
- pykyber-0.1.0/Cargo.toml +23 -0
- pykyber-0.1.0/LICENSE +21 -0
- pykyber-0.1.0/Makefile +15 -0
- pykyber-0.1.0/PKG-INFO +83 -0
- pykyber-0.1.0/README.md +67 -0
- pykyber-0.1.0/pyproject.toml +26 -0
- pykyber-0.1.0/python/pykyber/__init__.py +23 -0
- pykyber-0.1.0/python/pykyber/_kyber.py +113 -0
- pykyber-0.1.0/python/pykyber/py.typed +0 -0
- pykyber-0.1.0/python/tests/test_kyber.py +458 -0
- pykyber-0.1.0/requirements.txt +1 -0
- pykyber-0.1.0/src/kyber/api.rs +96 -0
- pykyber-0.1.0/src/kyber/cbd.rs +54 -0
- pykyber-0.1.0/src/kyber/error.rs +21 -0
- pykyber-0.1.0/src/kyber/fips202.rs +458 -0
- pykyber-0.1.0/src/kyber/indcpa.rs +568 -0
- pykyber-0.1.0/src/kyber/kem.rs +248 -0
- pykyber-0.1.0/src/kyber/mod.rs +35 -0
- pykyber-0.1.0/src/kyber/ntt.rs +90 -0
- pykyber-0.1.0/src/kyber/params.rs +65 -0
- pykyber-0.1.0/src/kyber/poly.rs +166 -0
- pykyber-0.1.0/src/kyber/polyvec.rs +355 -0
- pykyber-0.1.0/src/kyber/reduce.rs +20 -0
- pykyber-0.1.0/src/kyber/symmetric.rs +72 -0
- pykyber-0.1.0/src/kyber/verify.rs +15 -0
- pykyber-0.1.0/src/lib.rs +192 -0
- pykyber-0.1.0/tests/api_kem.rs +225 -0
- pykyber-0.1.0/tests/integration_kem.rs +192 -0
- pykyber-0.1.0/tests/unit_params.rs +55 -0
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
# This file is autogenerated by maturin v1.12.3
|
|
2
|
+
# To update, run
|
|
3
|
+
#
|
|
4
|
+
# maturin generate-ci github
|
|
5
|
+
#
|
|
6
|
+
name: CI
|
|
7
|
+
|
|
8
|
+
on:
|
|
9
|
+
push:
|
|
10
|
+
branches:
|
|
11
|
+
- main
|
|
12
|
+
tags:
|
|
13
|
+
- '*'
|
|
14
|
+
pull_request:
|
|
15
|
+
workflow_dispatch:
|
|
16
|
+
|
|
17
|
+
permissions:
|
|
18
|
+
contents: read
|
|
19
|
+
|
|
20
|
+
jobs:
|
|
21
|
+
linux:
|
|
22
|
+
runs-on: ${{ matrix.platform.runner }}
|
|
23
|
+
strategy:
|
|
24
|
+
matrix:
|
|
25
|
+
platform:
|
|
26
|
+
- runner: ubuntu-22.04
|
|
27
|
+
target: x86_64
|
|
28
|
+
- runner: ubuntu-22.04
|
|
29
|
+
target: x86
|
|
30
|
+
- runner: ubuntu-22.04
|
|
31
|
+
target: aarch64
|
|
32
|
+
- runner: ubuntu-22.04
|
|
33
|
+
target: armv7
|
|
34
|
+
- runner: ubuntu-22.04
|
|
35
|
+
target: s390x
|
|
36
|
+
- runner: ubuntu-22.04
|
|
37
|
+
target: ppc64le
|
|
38
|
+
steps:
|
|
39
|
+
- uses: actions/checkout@v6
|
|
40
|
+
- uses: actions/setup-python@v6
|
|
41
|
+
with:
|
|
42
|
+
python-version: 3.x
|
|
43
|
+
- name: Build wheels
|
|
44
|
+
uses: PyO3/maturin-action@v1
|
|
45
|
+
with:
|
|
46
|
+
target: ${{ matrix.platform.target }}
|
|
47
|
+
args: --release --out dist --find-interpreter
|
|
48
|
+
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
|
49
|
+
manylinux: auto
|
|
50
|
+
- name: Upload wheels
|
|
51
|
+
uses: actions/upload-artifact@v5
|
|
52
|
+
with:
|
|
53
|
+
name: wheels-linux-${{ matrix.platform.target }}
|
|
54
|
+
path: dist
|
|
55
|
+
|
|
56
|
+
musllinux:
|
|
57
|
+
runs-on: ${{ matrix.platform.runner }}
|
|
58
|
+
strategy:
|
|
59
|
+
matrix:
|
|
60
|
+
platform:
|
|
61
|
+
- runner: ubuntu-22.04
|
|
62
|
+
target: x86_64
|
|
63
|
+
- runner: ubuntu-22.04
|
|
64
|
+
target: x86
|
|
65
|
+
- runner: ubuntu-22.04
|
|
66
|
+
target: aarch64
|
|
67
|
+
- runner: ubuntu-22.04
|
|
68
|
+
target: armv7
|
|
69
|
+
steps:
|
|
70
|
+
- uses: actions/checkout@v6
|
|
71
|
+
- uses: actions/setup-python@v6
|
|
72
|
+
with:
|
|
73
|
+
python-version: 3.x
|
|
74
|
+
- name: Build wheels
|
|
75
|
+
uses: PyO3/maturin-action@v1
|
|
76
|
+
with:
|
|
77
|
+
target: ${{ matrix.platform.target }}
|
|
78
|
+
args: --release --out dist --find-interpreter
|
|
79
|
+
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
|
80
|
+
manylinux: musllinux_1_2
|
|
81
|
+
- name: Upload wheels
|
|
82
|
+
uses: actions/upload-artifact@v5
|
|
83
|
+
with:
|
|
84
|
+
name: wheels-musllinux-${{ matrix.platform.target }}
|
|
85
|
+
path: dist
|
|
86
|
+
|
|
87
|
+
windows:
|
|
88
|
+
runs-on: ${{ matrix.platform.runner }}
|
|
89
|
+
strategy:
|
|
90
|
+
matrix:
|
|
91
|
+
platform:
|
|
92
|
+
- runner: windows-latest
|
|
93
|
+
target: x64
|
|
94
|
+
python_arch: x64
|
|
95
|
+
- runner: windows-latest
|
|
96
|
+
target: x86
|
|
97
|
+
python_arch: x86
|
|
98
|
+
- runner: windows-11-arm
|
|
99
|
+
target: aarch64
|
|
100
|
+
python_arch: arm64
|
|
101
|
+
steps:
|
|
102
|
+
- uses: actions/checkout@v6
|
|
103
|
+
- uses: actions/setup-python@v6
|
|
104
|
+
with:
|
|
105
|
+
python-version: 3.13
|
|
106
|
+
architecture: ${{ matrix.platform.python_arch }}
|
|
107
|
+
- name: Build wheels
|
|
108
|
+
uses: PyO3/maturin-action@v1
|
|
109
|
+
with:
|
|
110
|
+
target: ${{ matrix.platform.target }}
|
|
111
|
+
args: --release --out dist --find-interpreter
|
|
112
|
+
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
|
113
|
+
- name: Upload wheels
|
|
114
|
+
uses: actions/upload-artifact@v5
|
|
115
|
+
with:
|
|
116
|
+
name: wheels-windows-${{ matrix.platform.target }}
|
|
117
|
+
path: dist
|
|
118
|
+
|
|
119
|
+
macos:
|
|
120
|
+
runs-on: ${{ matrix.platform.runner }}
|
|
121
|
+
strategy:
|
|
122
|
+
matrix:
|
|
123
|
+
platform:
|
|
124
|
+
- runner: macos-15-intel
|
|
125
|
+
target: x86_64
|
|
126
|
+
- runner: macos-latest
|
|
127
|
+
target: aarch64
|
|
128
|
+
steps:
|
|
129
|
+
- uses: actions/checkout@v6
|
|
130
|
+
- uses: actions/setup-python@v6
|
|
131
|
+
with:
|
|
132
|
+
python-version: 3.x
|
|
133
|
+
- name: Build wheels
|
|
134
|
+
uses: PyO3/maturin-action@v1
|
|
135
|
+
with:
|
|
136
|
+
target: ${{ matrix.platform.target }}
|
|
137
|
+
args: --release --out dist --find-interpreter
|
|
138
|
+
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
|
139
|
+
- name: Upload wheels
|
|
140
|
+
uses: actions/upload-artifact@v5
|
|
141
|
+
with:
|
|
142
|
+
name: wheels-macos-${{ matrix.platform.target }}
|
|
143
|
+
path: dist
|
|
144
|
+
|
|
145
|
+
sdist:
|
|
146
|
+
runs-on: ubuntu-latest
|
|
147
|
+
steps:
|
|
148
|
+
- uses: actions/checkout@v6
|
|
149
|
+
- name: Build sdist
|
|
150
|
+
uses: PyO3/maturin-action@v1
|
|
151
|
+
with:
|
|
152
|
+
command: sdist
|
|
153
|
+
args: --out dist
|
|
154
|
+
- name: Upload sdist
|
|
155
|
+
uses: actions/upload-artifact@v5
|
|
156
|
+
with:
|
|
157
|
+
name: wheels-sdist
|
|
158
|
+
path: dist
|
|
159
|
+
|
|
160
|
+
release:
|
|
161
|
+
name: Release
|
|
162
|
+
runs-on: ubuntu-latest
|
|
163
|
+
if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }}
|
|
164
|
+
needs: [linux, musllinux, windows, macos, sdist]
|
|
165
|
+
permissions:
|
|
166
|
+
# Use to sign the release artifacts
|
|
167
|
+
id-token: write
|
|
168
|
+
# Used to upload release artifacts
|
|
169
|
+
contents: write
|
|
170
|
+
# Used to generate artifact attestation
|
|
171
|
+
attestations: write
|
|
172
|
+
steps:
|
|
173
|
+
- uses: actions/download-artifact@v6
|
|
174
|
+
- name: Generate artifact attestation
|
|
175
|
+
uses: actions/attest-build-provenance@v3
|
|
176
|
+
with:
|
|
177
|
+
subject-path: 'wheels-*/*'
|
|
178
|
+
- name: Install uv
|
|
179
|
+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
|
|
180
|
+
uses: astral-sh/setup-uv@v7
|
|
181
|
+
- name: Publish to PyPI
|
|
182
|
+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
|
|
183
|
+
run: uv publish 'wheels-*/*'
|
|
184
|
+
env:
|
|
185
|
+
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
|
pykyber-0.1.0/.gitignore
ADDED
pykyber-0.1.0/Cargo.lock
ADDED
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
# This file is automatically @generated by Cargo.
|
|
2
|
+
# It is not intended for manual editing.
|
|
3
|
+
version = 4
|
|
4
|
+
|
|
5
|
+
[[package]]
|
|
6
|
+
name = "autocfg"
|
|
7
|
+
version = "1.5.0"
|
|
8
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
9
|
+
checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
|
|
10
|
+
|
|
11
|
+
[[package]]
|
|
12
|
+
name = "cfg-if"
|
|
13
|
+
version = "1.0.4"
|
|
14
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
15
|
+
checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
|
|
16
|
+
|
|
17
|
+
[[package]]
|
|
18
|
+
name = "getrandom"
|
|
19
|
+
version = "0.2.17"
|
|
20
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
21
|
+
checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0"
|
|
22
|
+
dependencies = [
|
|
23
|
+
"cfg-if",
|
|
24
|
+
"libc",
|
|
25
|
+
"wasi",
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
[[package]]
|
|
29
|
+
name = "heck"
|
|
30
|
+
version = "0.5.0"
|
|
31
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
32
|
+
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
|
33
|
+
|
|
34
|
+
[[package]]
|
|
35
|
+
name = "indoc"
|
|
36
|
+
version = "2.0.7"
|
|
37
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
38
|
+
checksum = "79cf5c93f93228cf8efb3ba362535fb11199ac548a09ce117c9b1adc3030d706"
|
|
39
|
+
dependencies = [
|
|
40
|
+
"rustversion",
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
[[package]]
|
|
44
|
+
name = "libc"
|
|
45
|
+
version = "0.2.182"
|
|
46
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
47
|
+
checksum = "6800badb6cb2082ffd7b6a67e6125bb39f18782f793520caee8cb8846be06112"
|
|
48
|
+
|
|
49
|
+
[[package]]
|
|
50
|
+
name = "memoffset"
|
|
51
|
+
version = "0.9.1"
|
|
52
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
53
|
+
checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a"
|
|
54
|
+
dependencies = [
|
|
55
|
+
"autocfg",
|
|
56
|
+
]
|
|
57
|
+
|
|
58
|
+
[[package]]
|
|
59
|
+
name = "once_cell"
|
|
60
|
+
version = "1.21.3"
|
|
61
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
62
|
+
checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
|
|
63
|
+
|
|
64
|
+
[[package]]
|
|
65
|
+
name = "portable-atomic"
|
|
66
|
+
version = "1.13.1"
|
|
67
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
68
|
+
checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49"
|
|
69
|
+
|
|
70
|
+
[[package]]
|
|
71
|
+
name = "ppv-lite86"
|
|
72
|
+
version = "0.2.21"
|
|
73
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
74
|
+
checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9"
|
|
75
|
+
dependencies = [
|
|
76
|
+
"zerocopy",
|
|
77
|
+
]
|
|
78
|
+
|
|
79
|
+
[[package]]
|
|
80
|
+
name = "proc-macro2"
|
|
81
|
+
version = "1.0.106"
|
|
82
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
83
|
+
checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934"
|
|
84
|
+
dependencies = [
|
|
85
|
+
"unicode-ident",
|
|
86
|
+
]
|
|
87
|
+
|
|
88
|
+
[[package]]
|
|
89
|
+
name = "pykyber"
|
|
90
|
+
version = "0.1.0"
|
|
91
|
+
dependencies = [
|
|
92
|
+
"pyo3",
|
|
93
|
+
"rand",
|
|
94
|
+
"rand_core",
|
|
95
|
+
]
|
|
96
|
+
|
|
97
|
+
[[package]]
|
|
98
|
+
name = "pyo3"
|
|
99
|
+
version = "0.27.2"
|
|
100
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
101
|
+
checksum = "ab53c047fcd1a1d2a8820fe84f05d6be69e9526be40cb03b73f86b6b03e6d87d"
|
|
102
|
+
dependencies = [
|
|
103
|
+
"indoc",
|
|
104
|
+
"libc",
|
|
105
|
+
"memoffset",
|
|
106
|
+
"once_cell",
|
|
107
|
+
"portable-atomic",
|
|
108
|
+
"pyo3-build-config",
|
|
109
|
+
"pyo3-ffi",
|
|
110
|
+
"pyo3-macros",
|
|
111
|
+
"unindent",
|
|
112
|
+
]
|
|
113
|
+
|
|
114
|
+
[[package]]
|
|
115
|
+
name = "pyo3-build-config"
|
|
116
|
+
version = "0.27.2"
|
|
117
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
118
|
+
checksum = "b455933107de8642b4487ed26d912c2d899dec6114884214a0b3bb3be9261ea6"
|
|
119
|
+
dependencies = [
|
|
120
|
+
"target-lexicon",
|
|
121
|
+
]
|
|
122
|
+
|
|
123
|
+
[[package]]
|
|
124
|
+
name = "pyo3-ffi"
|
|
125
|
+
version = "0.27.2"
|
|
126
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
127
|
+
checksum = "1c85c9cbfaddf651b1221594209aed57e9e5cff63c4d11d1feead529b872a089"
|
|
128
|
+
dependencies = [
|
|
129
|
+
"libc",
|
|
130
|
+
"pyo3-build-config",
|
|
131
|
+
]
|
|
132
|
+
|
|
133
|
+
[[package]]
|
|
134
|
+
name = "pyo3-macros"
|
|
135
|
+
version = "0.27.2"
|
|
136
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
137
|
+
checksum = "0a5b10c9bf9888125d917fb4d2ca2d25c8df94c7ab5a52e13313a07e050a3b02"
|
|
138
|
+
dependencies = [
|
|
139
|
+
"proc-macro2",
|
|
140
|
+
"pyo3-macros-backend",
|
|
141
|
+
"quote",
|
|
142
|
+
"syn",
|
|
143
|
+
]
|
|
144
|
+
|
|
145
|
+
[[package]]
|
|
146
|
+
name = "pyo3-macros-backend"
|
|
147
|
+
version = "0.27.2"
|
|
148
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
149
|
+
checksum = "03b51720d314836e53327f5871d4c0cfb4fb37cc2c4a11cc71907a86342c40f9"
|
|
150
|
+
dependencies = [
|
|
151
|
+
"heck",
|
|
152
|
+
"proc-macro2",
|
|
153
|
+
"pyo3-build-config",
|
|
154
|
+
"quote",
|
|
155
|
+
"syn",
|
|
156
|
+
]
|
|
157
|
+
|
|
158
|
+
[[package]]
|
|
159
|
+
name = "quote"
|
|
160
|
+
version = "1.0.44"
|
|
161
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
162
|
+
checksum = "21b2ebcf727b7760c461f091f9f0f539b77b8e87f2fd88131e7f1b433b3cece4"
|
|
163
|
+
dependencies = [
|
|
164
|
+
"proc-macro2",
|
|
165
|
+
]
|
|
166
|
+
|
|
167
|
+
[[package]]
|
|
168
|
+
name = "rand"
|
|
169
|
+
version = "0.8.5"
|
|
170
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
171
|
+
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
|
|
172
|
+
dependencies = [
|
|
173
|
+
"libc",
|
|
174
|
+
"rand_chacha",
|
|
175
|
+
"rand_core",
|
|
176
|
+
]
|
|
177
|
+
|
|
178
|
+
[[package]]
|
|
179
|
+
name = "rand_chacha"
|
|
180
|
+
version = "0.3.1"
|
|
181
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
182
|
+
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
|
|
183
|
+
dependencies = [
|
|
184
|
+
"ppv-lite86",
|
|
185
|
+
"rand_core",
|
|
186
|
+
]
|
|
187
|
+
|
|
188
|
+
[[package]]
|
|
189
|
+
name = "rand_core"
|
|
190
|
+
version = "0.6.4"
|
|
191
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
192
|
+
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
|
|
193
|
+
dependencies = [
|
|
194
|
+
"getrandom",
|
|
195
|
+
]
|
|
196
|
+
|
|
197
|
+
[[package]]
|
|
198
|
+
name = "rustversion"
|
|
199
|
+
version = "1.0.22"
|
|
200
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
201
|
+
checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"
|
|
202
|
+
|
|
203
|
+
[[package]]
|
|
204
|
+
name = "syn"
|
|
205
|
+
version = "2.0.117"
|
|
206
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
207
|
+
checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99"
|
|
208
|
+
dependencies = [
|
|
209
|
+
"proc-macro2",
|
|
210
|
+
"quote",
|
|
211
|
+
"unicode-ident",
|
|
212
|
+
]
|
|
213
|
+
|
|
214
|
+
[[package]]
|
|
215
|
+
name = "target-lexicon"
|
|
216
|
+
version = "0.13.5"
|
|
217
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
218
|
+
checksum = "adb6935a6f5c20170eeceb1a3835a49e12e19d792f6dd344ccc76a985ca5a6ca"
|
|
219
|
+
|
|
220
|
+
[[package]]
|
|
221
|
+
name = "unicode-ident"
|
|
222
|
+
version = "1.0.24"
|
|
223
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
224
|
+
checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
|
|
225
|
+
|
|
226
|
+
[[package]]
|
|
227
|
+
name = "unindent"
|
|
228
|
+
version = "0.2.4"
|
|
229
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
230
|
+
checksum = "7264e107f553ccae879d21fbea1d6724ac785e8c3bfc762137959b5802826ef3"
|
|
231
|
+
|
|
232
|
+
[[package]]
|
|
233
|
+
name = "wasi"
|
|
234
|
+
version = "0.11.1+wasi-snapshot-preview1"
|
|
235
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
236
|
+
checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
|
|
237
|
+
|
|
238
|
+
[[package]]
|
|
239
|
+
name = "zerocopy"
|
|
240
|
+
version = "0.8.39"
|
|
241
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
242
|
+
checksum = "db6d35d663eadb6c932438e763b262fe1a70987f9ae936e60158176d710cae4a"
|
|
243
|
+
dependencies = [
|
|
244
|
+
"zerocopy-derive",
|
|
245
|
+
]
|
|
246
|
+
|
|
247
|
+
[[package]]
|
|
248
|
+
name = "zerocopy-derive"
|
|
249
|
+
version = "0.8.39"
|
|
250
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
251
|
+
checksum = "4122cd3169e94605190e77839c9a40d40ed048d305bfdc146e7df40ab0f3e517"
|
|
252
|
+
dependencies = [
|
|
253
|
+
"proc-macro2",
|
|
254
|
+
"quote",
|
|
255
|
+
"syn",
|
|
256
|
+
]
|
pykyber-0.1.0/Cargo.toml
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
[package]
|
|
2
|
+
name = "pykyber"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
edition = "2021"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
|
|
7
|
+
[lib]
|
|
8
|
+
name = "pykyber"
|
|
9
|
+
crate-type = ["lib", "cdylib"]
|
|
10
|
+
|
|
11
|
+
[dependencies]
|
|
12
|
+
pyo3 = "0.27.0"
|
|
13
|
+
rand = "0.8"
|
|
14
|
+
rand_core = "0.6"
|
|
15
|
+
|
|
16
|
+
[dev-dependencies]
|
|
17
|
+
rand = "0.8"
|
|
18
|
+
|
|
19
|
+
[profile.dev]
|
|
20
|
+
opt-level = 0
|
|
21
|
+
|
|
22
|
+
[profile.release]
|
|
23
|
+
opt-level = 3
|
pykyber-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ziki
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
pykyber-0.1.0/Makefile
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
dev-build: clean dev-build-pyi
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
dev-build-package:
|
|
7
|
+
maturin develop
|
|
8
|
+
|
|
9
|
+
dev-build-pyi: dev-build-package
|
|
10
|
+
pyo3-stubgen pykyber._pykyber ./python/
|
|
11
|
+
|
|
12
|
+
clean:
|
|
13
|
+
rm ./python/pykyber/*.so
|
|
14
|
+
rm ./python/pykyber/_pykyber.pyi
|
|
15
|
+
rm -rf ./target/
|
pykyber-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pykyber
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Classifier: Programming Language :: Python :: 3
|
|
5
|
+
Classifier: Programming Language :: Rust
|
|
6
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
7
|
+
Classifier: Operating System :: OS Independent
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Summary: Kyber post-quantum key encapsulation in Rust
|
|
10
|
+
Keywords: kyber,post-quantum,cryptography,pqc,key-encapsulation
|
|
11
|
+
Author: PyKyber Contributors
|
|
12
|
+
License: MIT
|
|
13
|
+
Requires-Python: >=3.8
|
|
14
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
15
|
+
|
|
16
|
+
# PyKyber
|
|
17
|
+
|
|
18
|
+
A Python library for Kyber post-quantum key encapsulation, implemented in Rust.
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
pip install pykyber
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Quick Start
|
|
27
|
+
|
|
28
|
+
```python
|
|
29
|
+
import pykyber
|
|
30
|
+
|
|
31
|
+
# Generate a keypair (Alice)
|
|
32
|
+
alice_keypair = pykyber.Kyber768()
|
|
33
|
+
|
|
34
|
+
# Encapsulate - create shared secret (Bob)
|
|
35
|
+
bob_result = pykyber.Kyber768.encapsulate(alice_keypair.public_key)
|
|
36
|
+
|
|
37
|
+
# Decapsulate - recover shared secret (Alice)
|
|
38
|
+
shared_secret = alice_keypair.decapsulate(bob_result.ciphertext)
|
|
39
|
+
|
|
40
|
+
# Both parties now share the same secret
|
|
41
|
+
print(f"Match: {bob_result.shared_secret == shared_secret}")
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## API Usage
|
|
45
|
+
|
|
46
|
+
### Class-based API (Recommended)
|
|
47
|
+
|
|
48
|
+
The simplest way to use Kyber:
|
|
49
|
+
|
|
50
|
+
```python
|
|
51
|
+
import pykyber
|
|
52
|
+
|
|
53
|
+
# Create a keypair - instant generation on class instantiation
|
|
54
|
+
keypair = pykyber.Kyber512() # ~AES-128 security
|
|
55
|
+
keypair = pykyber.Kyber768() # ~AES-192 security
|
|
56
|
+
keypair = pykyber.Kyber1024() # ~AES-256 security
|
|
57
|
+
|
|
58
|
+
# Access raw key bytes
|
|
59
|
+
public_key = keypair.public_key # bytes
|
|
60
|
+
secret_key = keypair.secret_key # bytes
|
|
61
|
+
|
|
62
|
+
# Encapsulate - create ciphertext and shared secret
|
|
63
|
+
result = keypair.encapsulate()
|
|
64
|
+
# result.ciphertext - bytes to send to receiver
|
|
65
|
+
# result.shared_secret - 32 bytes shared secret
|
|
66
|
+
|
|
67
|
+
# Decapsulate - recover shared secret from ciphertext
|
|
68
|
+
shared_secret = keypair.decapsulate(result.ciphertext)
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Key Sizes
|
|
72
|
+
|
|
73
|
+
| Variant | Public Key | Secret Key | Ciphertext | Shared Secret |
|
|
74
|
+
|-----------|------------|------------|------------|---------------|
|
|
75
|
+
| Kyber-512 | 800 bytes | 1632 bytes | 768 bytes | 32 bytes |
|
|
76
|
+
| Kyber-768 | 1184 bytes | 2400 bytes | 1088 bytes | 32 bytes |
|
|
77
|
+
| Kyber-1024| 1568 bytes | 3168 bytes | 1408 bytes | 32 bytes |
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
## License
|
|
81
|
+
|
|
82
|
+
MIT
|
|
83
|
+
|
pykyber-0.1.0/README.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# PyKyber
|
|
2
|
+
|
|
3
|
+
A Python library for Kyber post-quantum key encapsulation, implemented in Rust.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install pykyber
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```python
|
|
14
|
+
import pykyber
|
|
15
|
+
|
|
16
|
+
# Generate a keypair (Alice)
|
|
17
|
+
alice_keypair = pykyber.Kyber768()
|
|
18
|
+
|
|
19
|
+
# Encapsulate - create shared secret (Bob)
|
|
20
|
+
bob_result = pykyber.Kyber768.encapsulate(alice_keypair.public_key)
|
|
21
|
+
|
|
22
|
+
# Decapsulate - recover shared secret (Alice)
|
|
23
|
+
shared_secret = alice_keypair.decapsulate(bob_result.ciphertext)
|
|
24
|
+
|
|
25
|
+
# Both parties now share the same secret
|
|
26
|
+
print(f"Match: {bob_result.shared_secret == shared_secret}")
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## API Usage
|
|
30
|
+
|
|
31
|
+
### Class-based API (Recommended)
|
|
32
|
+
|
|
33
|
+
The simplest way to use Kyber:
|
|
34
|
+
|
|
35
|
+
```python
|
|
36
|
+
import pykyber
|
|
37
|
+
|
|
38
|
+
# Create a keypair - instant generation on class instantiation
|
|
39
|
+
keypair = pykyber.Kyber512() # ~AES-128 security
|
|
40
|
+
keypair = pykyber.Kyber768() # ~AES-192 security
|
|
41
|
+
keypair = pykyber.Kyber1024() # ~AES-256 security
|
|
42
|
+
|
|
43
|
+
# Access raw key bytes
|
|
44
|
+
public_key = keypair.public_key # bytes
|
|
45
|
+
secret_key = keypair.secret_key # bytes
|
|
46
|
+
|
|
47
|
+
# Encapsulate - create ciphertext and shared secret
|
|
48
|
+
result = keypair.encapsulate()
|
|
49
|
+
# result.ciphertext - bytes to send to receiver
|
|
50
|
+
# result.shared_secret - 32 bytes shared secret
|
|
51
|
+
|
|
52
|
+
# Decapsulate - recover shared secret from ciphertext
|
|
53
|
+
shared_secret = keypair.decapsulate(result.ciphertext)
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Key Sizes
|
|
57
|
+
|
|
58
|
+
| Variant | Public Key | Secret Key | Ciphertext | Shared Secret |
|
|
59
|
+
|-----------|------------|------------|------------|---------------|
|
|
60
|
+
| Kyber-512 | 800 bytes | 1632 bytes | 768 bytes | 32 bytes |
|
|
61
|
+
| Kyber-768 | 1184 bytes | 2400 bytes | 1088 bytes | 32 bytes |
|
|
62
|
+
| Kyber-1024| 1568 bytes | 3168 bytes | 1408 bytes | 32 bytes |
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
## License
|
|
66
|
+
|
|
67
|
+
MIT
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["maturin>=1.12,<2.0"]
|
|
3
|
+
build-backend = "maturin"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "pykyber"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Kyber post-quantum key encapsulation in Rust"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.8"
|
|
11
|
+
license = {text = "MIT"}
|
|
12
|
+
authors = [
|
|
13
|
+
{name = "PyKyber Contributors"}
|
|
14
|
+
]
|
|
15
|
+
keywords = ["kyber", "post-quantum", "cryptography", "pqc", "key-encapsulation"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Programming Language :: Python :: 3",
|
|
18
|
+
"Programming Language :: Rust",
|
|
19
|
+
"License :: OSI Approved :: MIT License",
|
|
20
|
+
"Operating System :: OS Independent",
|
|
21
|
+
]
|
|
22
|
+
project_urls = {Homepage = "https://github.com/Zikithezikit/pykyber"}
|
|
23
|
+
|
|
24
|
+
[tool.maturin]
|
|
25
|
+
python-source = "python"
|
|
26
|
+
module-name = "pykyber._pykyber"
|