python-swoosh 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.
- python_swoosh-0.1.0/Cargo.lock +381 -0
- python_swoosh-0.1.0/Cargo.toml +20 -0
- python_swoosh-0.1.0/LICENSE +21 -0
- python_swoosh-0.1.0/PKG-INFO +69 -0
- python_swoosh-0.1.0/README.md +53 -0
- python_swoosh-0.1.0/pyproject.toml +27 -0
- python_swoosh-0.1.0/src/lib.rs +93 -0
- python_swoosh-0.1.0/swoosh/__init__.py +6 -0
- python_swoosh-0.1.0/swoosh/__init__.pyi +22 -0
- python_swoosh-0.1.0/vendor/ref0/Cargo.toml +34 -0
- python_swoosh-0.1.0/vendor/ref0/build.rs +3 -0
- python_swoosh-0.1.0/vendor/ref0/src/aesenc-int.c +266 -0
- python_swoosh-0.1.0/vendor/ref0/src/arithmetic/fq.rs +302 -0
- python_swoosh-0.1.0/vendor/ref0/src/arithmetic/fq.s +2718 -0
- python_swoosh-0.1.0/vendor/ref0/src/arithmetic/mod.rs +5 -0
- python_swoosh-0.1.0/vendor/ref0/src/arithmetic/params.rs +2 -0
- python_swoosh-0.1.0/vendor/ref0/src/arithmetic/poly.rs +260 -0
- python_swoosh-0.1.0/vendor/ref0/src/arithmetic/polyvec.rs +116 -0
- python_swoosh-0.1.0/vendor/ref0/src/arithmetic/zetas.rs +525 -0
- python_swoosh-0.1.0/vendor/ref0/src/bin/bench_full.rs +87 -0
- python_swoosh-0.1.0/vendor/ref0/src/bin/bench_scheme.rs +25 -0
- python_swoosh-0.1.0/vendor/ref0/src/bin/swoosh.rs +181 -0
- python_swoosh-0.1.0/vendor/ref0/src/lib.rs +540 -0
- python_swoosh-0.1.0/vendor/ref0/src/sysA.rs +4 -0
- python_swoosh-0.1.0/vendor/ref0/src/sys_param.rs +1 -0
- python_swoosh-0.1.0/vendor/ref0/src/util.rs +65 -0
|
@@ -0,0 +1,381 @@
|
|
|
1
|
+
# This file is automatically @generated by Cargo.
|
|
2
|
+
# It is not intended for manual editing.
|
|
3
|
+
version = 4
|
|
4
|
+
|
|
5
|
+
[[package]]
|
|
6
|
+
name = "aes"
|
|
7
|
+
version = "0.8.4"
|
|
8
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
9
|
+
checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0"
|
|
10
|
+
dependencies = [
|
|
11
|
+
"cfg-if",
|
|
12
|
+
"cipher",
|
|
13
|
+
"cpufeatures",
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
[[package]]
|
|
17
|
+
name = "autocfg"
|
|
18
|
+
version = "1.5.1"
|
|
19
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
20
|
+
checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53"
|
|
21
|
+
|
|
22
|
+
[[package]]
|
|
23
|
+
name = "bitflags"
|
|
24
|
+
version = "2.13.2"
|
|
25
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
26
|
+
checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06"
|
|
27
|
+
|
|
28
|
+
[[package]]
|
|
29
|
+
name = "block-buffer"
|
|
30
|
+
version = "0.10.4"
|
|
31
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
32
|
+
checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"
|
|
33
|
+
dependencies = [
|
|
34
|
+
"generic-array",
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
[[package]]
|
|
38
|
+
name = "cfg-if"
|
|
39
|
+
version = "1.0.5"
|
|
40
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
41
|
+
checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600"
|
|
42
|
+
|
|
43
|
+
[[package]]
|
|
44
|
+
name = "cipher"
|
|
45
|
+
version = "0.4.4"
|
|
46
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
47
|
+
checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad"
|
|
48
|
+
dependencies = [
|
|
49
|
+
"crypto-common",
|
|
50
|
+
"inout",
|
|
51
|
+
]
|
|
52
|
+
|
|
53
|
+
[[package]]
|
|
54
|
+
name = "cpufeatures"
|
|
55
|
+
version = "0.2.17"
|
|
56
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
57
|
+
checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280"
|
|
58
|
+
dependencies = [
|
|
59
|
+
"libc",
|
|
60
|
+
]
|
|
61
|
+
|
|
62
|
+
[[package]]
|
|
63
|
+
name = "crypto-common"
|
|
64
|
+
version = "0.1.7"
|
|
65
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
66
|
+
checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a"
|
|
67
|
+
dependencies = [
|
|
68
|
+
"generic-array",
|
|
69
|
+
"typenum",
|
|
70
|
+
]
|
|
71
|
+
|
|
72
|
+
[[package]]
|
|
73
|
+
name = "digest"
|
|
74
|
+
version = "0.10.7"
|
|
75
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
76
|
+
checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
|
|
77
|
+
dependencies = [
|
|
78
|
+
"block-buffer",
|
|
79
|
+
"crypto-common",
|
|
80
|
+
]
|
|
81
|
+
|
|
82
|
+
[[package]]
|
|
83
|
+
name = "generic-array"
|
|
84
|
+
version = "0.14.7"
|
|
85
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
86
|
+
checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a"
|
|
87
|
+
dependencies = [
|
|
88
|
+
"typenum",
|
|
89
|
+
"version_check",
|
|
90
|
+
]
|
|
91
|
+
|
|
92
|
+
[[package]]
|
|
93
|
+
name = "getrandom"
|
|
94
|
+
version = "0.2.17"
|
|
95
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
96
|
+
checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0"
|
|
97
|
+
dependencies = [
|
|
98
|
+
"cfg-if",
|
|
99
|
+
"libc",
|
|
100
|
+
"wasi",
|
|
101
|
+
]
|
|
102
|
+
|
|
103
|
+
[[package]]
|
|
104
|
+
name = "heck"
|
|
105
|
+
version = "0.4.1"
|
|
106
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
107
|
+
checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
|
|
108
|
+
|
|
109
|
+
[[package]]
|
|
110
|
+
name = "indoc"
|
|
111
|
+
version = "2.0.7"
|
|
112
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
113
|
+
checksum = "79cf5c93f93228cf8efb3ba362535fb11199ac548a09ce117c9b1adc3030d706"
|
|
114
|
+
dependencies = [
|
|
115
|
+
"rustversion",
|
|
116
|
+
]
|
|
117
|
+
|
|
118
|
+
[[package]]
|
|
119
|
+
name = "inout"
|
|
120
|
+
version = "0.1.4"
|
|
121
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
122
|
+
checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01"
|
|
123
|
+
dependencies = [
|
|
124
|
+
"generic-array",
|
|
125
|
+
]
|
|
126
|
+
|
|
127
|
+
[[package]]
|
|
128
|
+
name = "keccak"
|
|
129
|
+
version = "0.1.6"
|
|
130
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
131
|
+
checksum = "cb26cec98cce3a3d96cbb7bced3c4b16e3d13f27ec56dbd62cbc8f39cfb9d653"
|
|
132
|
+
dependencies = [
|
|
133
|
+
"cpufeatures",
|
|
134
|
+
]
|
|
135
|
+
|
|
136
|
+
[[package]]
|
|
137
|
+
name = "libc"
|
|
138
|
+
version = "0.2.189"
|
|
139
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
140
|
+
checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2"
|
|
141
|
+
|
|
142
|
+
[[package]]
|
|
143
|
+
name = "lock_api"
|
|
144
|
+
version = "0.4.14"
|
|
145
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
146
|
+
checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965"
|
|
147
|
+
dependencies = [
|
|
148
|
+
"scopeguard",
|
|
149
|
+
]
|
|
150
|
+
|
|
151
|
+
[[package]]
|
|
152
|
+
name = "memoffset"
|
|
153
|
+
version = "0.9.1"
|
|
154
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
155
|
+
checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a"
|
|
156
|
+
dependencies = [
|
|
157
|
+
"autocfg",
|
|
158
|
+
]
|
|
159
|
+
|
|
160
|
+
[[package]]
|
|
161
|
+
name = "once_cell"
|
|
162
|
+
version = "1.21.4"
|
|
163
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
164
|
+
checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
|
|
165
|
+
|
|
166
|
+
[[package]]
|
|
167
|
+
name = "parking_lot"
|
|
168
|
+
version = "0.12.5"
|
|
169
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
170
|
+
checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a"
|
|
171
|
+
dependencies = [
|
|
172
|
+
"lock_api",
|
|
173
|
+
"parking_lot_core",
|
|
174
|
+
]
|
|
175
|
+
|
|
176
|
+
[[package]]
|
|
177
|
+
name = "parking_lot_core"
|
|
178
|
+
version = "0.9.12"
|
|
179
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
180
|
+
checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1"
|
|
181
|
+
dependencies = [
|
|
182
|
+
"cfg-if",
|
|
183
|
+
"libc",
|
|
184
|
+
"redox_syscall",
|
|
185
|
+
"smallvec",
|
|
186
|
+
"windows-link",
|
|
187
|
+
]
|
|
188
|
+
|
|
189
|
+
[[package]]
|
|
190
|
+
name = "portable-atomic"
|
|
191
|
+
version = "1.15.0"
|
|
192
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
193
|
+
checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85"
|
|
194
|
+
|
|
195
|
+
[[package]]
|
|
196
|
+
name = "proc-macro2"
|
|
197
|
+
version = "1.0.107"
|
|
198
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
199
|
+
checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"
|
|
200
|
+
dependencies = [
|
|
201
|
+
"unicode-ident",
|
|
202
|
+
]
|
|
203
|
+
|
|
204
|
+
[[package]]
|
|
205
|
+
name = "pyo3"
|
|
206
|
+
version = "0.20.3"
|
|
207
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
208
|
+
checksum = "53bdbb96d49157e65d45cc287af5f32ffadd5f4761438b527b055fb0d4bb8233"
|
|
209
|
+
dependencies = [
|
|
210
|
+
"cfg-if",
|
|
211
|
+
"indoc",
|
|
212
|
+
"libc",
|
|
213
|
+
"memoffset",
|
|
214
|
+
"parking_lot",
|
|
215
|
+
"portable-atomic",
|
|
216
|
+
"pyo3-build-config",
|
|
217
|
+
"pyo3-ffi",
|
|
218
|
+
"pyo3-macros",
|
|
219
|
+
"unindent",
|
|
220
|
+
]
|
|
221
|
+
|
|
222
|
+
[[package]]
|
|
223
|
+
name = "pyo3-build-config"
|
|
224
|
+
version = "0.20.3"
|
|
225
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
226
|
+
checksum = "deaa5745de3f5231ce10517a1f5dd97d53e5a2fd77aa6b5842292085831d48d7"
|
|
227
|
+
dependencies = [
|
|
228
|
+
"once_cell",
|
|
229
|
+
"target-lexicon",
|
|
230
|
+
]
|
|
231
|
+
|
|
232
|
+
[[package]]
|
|
233
|
+
name = "pyo3-ffi"
|
|
234
|
+
version = "0.20.3"
|
|
235
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
236
|
+
checksum = "62b42531d03e08d4ef1f6e85a2ed422eb678b8cd62b762e53891c05faf0d4afa"
|
|
237
|
+
dependencies = [
|
|
238
|
+
"libc",
|
|
239
|
+
"pyo3-build-config",
|
|
240
|
+
]
|
|
241
|
+
|
|
242
|
+
[[package]]
|
|
243
|
+
name = "pyo3-macros"
|
|
244
|
+
version = "0.20.3"
|
|
245
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
246
|
+
checksum = "7305c720fa01b8055ec95e484a6eca7a83c841267f0dd5280f0c8b8551d2c158"
|
|
247
|
+
dependencies = [
|
|
248
|
+
"proc-macro2",
|
|
249
|
+
"pyo3-macros-backend",
|
|
250
|
+
"quote",
|
|
251
|
+
"syn",
|
|
252
|
+
]
|
|
253
|
+
|
|
254
|
+
[[package]]
|
|
255
|
+
name = "pyo3-macros-backend"
|
|
256
|
+
version = "0.20.3"
|
|
257
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
258
|
+
checksum = "7c7e9b68bb9c3149c5b0cade5d07f953d6d125eb4337723c4ccdb665f1f96185"
|
|
259
|
+
dependencies = [
|
|
260
|
+
"heck",
|
|
261
|
+
"proc-macro2",
|
|
262
|
+
"pyo3-build-config",
|
|
263
|
+
"quote",
|
|
264
|
+
"syn",
|
|
265
|
+
]
|
|
266
|
+
|
|
267
|
+
[[package]]
|
|
268
|
+
name = "quote"
|
|
269
|
+
version = "1.0.47"
|
|
270
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
271
|
+
checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"
|
|
272
|
+
dependencies = [
|
|
273
|
+
"proc-macro2",
|
|
274
|
+
]
|
|
275
|
+
|
|
276
|
+
[[package]]
|
|
277
|
+
name = "redox_syscall"
|
|
278
|
+
version = "0.5.18"
|
|
279
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
280
|
+
checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d"
|
|
281
|
+
dependencies = [
|
|
282
|
+
"bitflags",
|
|
283
|
+
]
|
|
284
|
+
|
|
285
|
+
[[package]]
|
|
286
|
+
name = "ref0"
|
|
287
|
+
version = "0.1.0"
|
|
288
|
+
dependencies = [
|
|
289
|
+
"aes",
|
|
290
|
+
"getrandom",
|
|
291
|
+
"sha3",
|
|
292
|
+
]
|
|
293
|
+
|
|
294
|
+
[[package]]
|
|
295
|
+
name = "rustversion"
|
|
296
|
+
version = "1.0.23"
|
|
297
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
298
|
+
checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f"
|
|
299
|
+
|
|
300
|
+
[[package]]
|
|
301
|
+
name = "scopeguard"
|
|
302
|
+
version = "1.2.0"
|
|
303
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
304
|
+
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
|
|
305
|
+
|
|
306
|
+
[[package]]
|
|
307
|
+
name = "sha3"
|
|
308
|
+
version = "0.10.9"
|
|
309
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
310
|
+
checksum = "77fd7028345d415a4034cf8777cd4f8ab1851274233b45f84e3d955502d93874"
|
|
311
|
+
dependencies = [
|
|
312
|
+
"digest",
|
|
313
|
+
"keccak",
|
|
314
|
+
]
|
|
315
|
+
|
|
316
|
+
[[package]]
|
|
317
|
+
name = "smallvec"
|
|
318
|
+
version = "1.16.1"
|
|
319
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
320
|
+
checksum = "ba467056f1b547ed52077911161fc86985becbc60e8e1857c8a144dab0def891"
|
|
321
|
+
|
|
322
|
+
[[package]]
|
|
323
|
+
name = "swoosh"
|
|
324
|
+
version = "0.1.0"
|
|
325
|
+
dependencies = [
|
|
326
|
+
"pyo3",
|
|
327
|
+
"ref0",
|
|
328
|
+
]
|
|
329
|
+
|
|
330
|
+
[[package]]
|
|
331
|
+
name = "syn"
|
|
332
|
+
version = "2.0.119"
|
|
333
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
334
|
+
checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297"
|
|
335
|
+
dependencies = [
|
|
336
|
+
"proc-macro2",
|
|
337
|
+
"quote",
|
|
338
|
+
"unicode-ident",
|
|
339
|
+
]
|
|
340
|
+
|
|
341
|
+
[[package]]
|
|
342
|
+
name = "target-lexicon"
|
|
343
|
+
version = "0.12.16"
|
|
344
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
345
|
+
checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1"
|
|
346
|
+
|
|
347
|
+
[[package]]
|
|
348
|
+
name = "typenum"
|
|
349
|
+
version = "1.20.1"
|
|
350
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
351
|
+
checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20"
|
|
352
|
+
|
|
353
|
+
[[package]]
|
|
354
|
+
name = "unicode-ident"
|
|
355
|
+
version = "1.0.26"
|
|
356
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
357
|
+
checksum = "d245f478577f809a851594d02313b640fb437e0bb33866753cff937863096954"
|
|
358
|
+
|
|
359
|
+
[[package]]
|
|
360
|
+
name = "unindent"
|
|
361
|
+
version = "0.2.4"
|
|
362
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
363
|
+
checksum = "7264e107f553ccae879d21fbea1d6724ac785e8c3bfc762137959b5802826ef3"
|
|
364
|
+
|
|
365
|
+
[[package]]
|
|
366
|
+
name = "version_check"
|
|
367
|
+
version = "0.9.5"
|
|
368
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
369
|
+
checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
|
|
370
|
+
|
|
371
|
+
[[package]]
|
|
372
|
+
name = "wasi"
|
|
373
|
+
version = "0.11.1+wasi-snapshot-preview1"
|
|
374
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
375
|
+
checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
|
|
376
|
+
|
|
377
|
+
[[package]]
|
|
378
|
+
name = "windows-link"
|
|
379
|
+
version = "0.2.1"
|
|
380
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
381
|
+
checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
[package]
|
|
2
|
+
name = "swoosh"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
edition = "2021"
|
|
5
|
+
description = "Python bindings for the SWOOSH lattice-based NIKE reference implementation"
|
|
6
|
+
license = "MIT"
|
|
7
|
+
readme = "README.md"
|
|
8
|
+
|
|
9
|
+
[lib]
|
|
10
|
+
name = "swoosh"
|
|
11
|
+
crate-type = ["cdylib"]
|
|
12
|
+
|
|
13
|
+
[dependencies]
|
|
14
|
+
pyo3 = { version = "0.20", features = ["extension-module"] }
|
|
15
|
+
ref0 = { path = "vendor/ref0" }
|
|
16
|
+
|
|
17
|
+
[profile.release]
|
|
18
|
+
opt-level = 3
|
|
19
|
+
strip = true
|
|
20
|
+
lto = true
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 swoosh contributors
|
|
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.
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: python-swoosh
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Classifier: Programming Language :: Rust
|
|
5
|
+
Classifier: Programming Language :: Python :: 3
|
|
6
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
7
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
8
|
+
Classifier: Operating System :: OS Independent
|
|
9
|
+
Classifier: Topic :: Security :: Cryptography
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Summary: Python bindings for the SWOOSH lattice-based NIKE reference implementation
|
|
12
|
+
Keywords: cryptography,kem,nike,lattice,swoosh
|
|
13
|
+
Requires-Python: >=3.8
|
|
14
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
15
|
+
|
|
16
|
+
# swoosh — Python bindings for Passive-Swoosh
|
|
17
|
+
|
|
18
|
+
Python bindings for the **Swoosh** practical lattice-based
|
|
19
|
+
non-interactive key exchange (Passive-Swoosh construction).
|
|
20
|
+
|
|
21
|
+
For background see: https://eprint.iacr.org/2023/271.
|
|
22
|
+
|
|
23
|
+
## Install
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
pip install python-swoosh
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Usage
|
|
30
|
+
|
|
31
|
+
```python
|
|
32
|
+
from swoosh import keygen, derive_shared_secret
|
|
33
|
+
|
|
34
|
+
# Party A and Party B each generate a keypair
|
|
35
|
+
sk_a, pk_a = keygen(True) # is_party_a=True
|
|
36
|
+
sk_b, pk_b = keygen(False) # is_party_a=False
|
|
37
|
+
|
|
38
|
+
# Each side derives the shared secret using (own_pk, other_pk)
|
|
39
|
+
ss_a = derive_shared_secret(pk_a, pk_b, sk_a, True)
|
|
40
|
+
ss_b = derive_shared_secret(pk_b, pk_a, sk_b, False)
|
|
41
|
+
|
|
42
|
+
assert ss_a == ss_b # 32-byte shared secret
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
> **Note:** `derive_shared_secret` takes `(own_pk, other_pk, sk,
|
|
46
|
+
> is_party_a)`. Both sides must pass their *own* public key first,
|
|
47
|
+
> otherwise the derived secrets will not match.
|
|
48
|
+
|
|
49
|
+
Key/signature sizes: secret keys and public keys are 221184 bytes each;
|
|
50
|
+
shared secrets are 32 bytes.
|
|
51
|
+
|
|
52
|
+
## API
|
|
53
|
+
|
|
54
|
+
- `keygen(is_party_a: bool) -> (secret_key: bytes, public_key: bytes)`
|
|
55
|
+
- `derive_shared_secret(own_pk: bytes, other_pk: bytes, sk: bytes, is_party_a: bool) -> bytes`
|
|
56
|
+
|
|
57
|
+
## Building from source
|
|
58
|
+
|
|
59
|
+
Requires Rust (stable) and `maturin >= 1.0`:
|
|
60
|
+
|
|
61
|
+
```sh
|
|
62
|
+
pip install maturin
|
|
63
|
+
maturin develop --release
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## License
|
|
67
|
+
|
|
68
|
+
MIT
|
|
69
|
+
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# swoosh — Python bindings for Passive-Swoosh
|
|
2
|
+
|
|
3
|
+
Python bindings for the **Swoosh** practical lattice-based
|
|
4
|
+
non-interactive key exchange (Passive-Swoosh construction).
|
|
5
|
+
|
|
6
|
+
For background see: https://eprint.iacr.org/2023/271.
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
pip install python-swoosh
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
```python
|
|
17
|
+
from swoosh import keygen, derive_shared_secret
|
|
18
|
+
|
|
19
|
+
# Party A and Party B each generate a keypair
|
|
20
|
+
sk_a, pk_a = keygen(True) # is_party_a=True
|
|
21
|
+
sk_b, pk_b = keygen(False) # is_party_a=False
|
|
22
|
+
|
|
23
|
+
# Each side derives the shared secret using (own_pk, other_pk)
|
|
24
|
+
ss_a = derive_shared_secret(pk_a, pk_b, sk_a, True)
|
|
25
|
+
ss_b = derive_shared_secret(pk_b, pk_a, sk_b, False)
|
|
26
|
+
|
|
27
|
+
assert ss_a == ss_b # 32-byte shared secret
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
> **Note:** `derive_shared_secret` takes `(own_pk, other_pk, sk,
|
|
31
|
+
> is_party_a)`. Both sides must pass their *own* public key first,
|
|
32
|
+
> otherwise the derived secrets will not match.
|
|
33
|
+
|
|
34
|
+
Key/signature sizes: secret keys and public keys are 221184 bytes each;
|
|
35
|
+
shared secrets are 32 bytes.
|
|
36
|
+
|
|
37
|
+
## API
|
|
38
|
+
|
|
39
|
+
- `keygen(is_party_a: bool) -> (secret_key: bytes, public_key: bytes)`
|
|
40
|
+
- `derive_shared_secret(own_pk: bytes, other_pk: bytes, sk: bytes, is_party_a: bool) -> bytes`
|
|
41
|
+
|
|
42
|
+
## Building from source
|
|
43
|
+
|
|
44
|
+
Requires Rust (stable) and `maturin >= 1.0`:
|
|
45
|
+
|
|
46
|
+
```sh
|
|
47
|
+
pip install maturin
|
|
48
|
+
maturin develop --release
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## License
|
|
52
|
+
|
|
53
|
+
MIT
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["maturin>=1.0,<2.0"]
|
|
3
|
+
build-backend = "maturin"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "python-swoosh"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Python bindings for the SWOOSH lattice-based NIKE reference implementation"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.8"
|
|
11
|
+
license = { file = "LICENSE" }
|
|
12
|
+
keywords = ["cryptography", "kem", "nike", "lattice", "swoosh"]
|
|
13
|
+
classifiers = [
|
|
14
|
+
"Programming Language :: Rust",
|
|
15
|
+
"Programming Language :: Python :: 3",
|
|
16
|
+
"Programming Language :: Python :: Implementation :: CPython",
|
|
17
|
+
"License :: OSI Approved :: MIT License",
|
|
18
|
+
"Operating System :: OS Independent",
|
|
19
|
+
"Topic :: Security :: Cryptography",
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
[tool.maturin]
|
|
23
|
+
bindings = "pyo3"
|
|
24
|
+
python-source = "."
|
|
25
|
+
module-name = "swoosh._swoosh"
|
|
26
|
+
strip = true
|
|
27
|
+
exclude = ["debug.log", "test_*.py", "target/**", ".venv/**", "**/__pycache__/**", "**/*.pyc", "**/*.pdb", "**/*.pyd"]
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
use pyo3::prelude::*;
|
|
2
|
+
use pyo3::types::PyBytes;
|
|
3
|
+
use pyo3::exceptions::{PyRuntimeError, PyValueError};
|
|
4
|
+
use ref0::{pswoosh_keygen, pswoosh_skey_deriv, sysA, SYMBYTES, PUBLICKEY_BYTES, SECRETKEY_BYTES};
|
|
5
|
+
|
|
6
|
+
/// Stack size for the worker thread.
|
|
7
|
+
///
|
|
8
|
+
/// `kg` / `sdk` keep many megabytes of live stack (the byte-array return
|
|
9
|
+
/// values plus several in-memory polyvecs, which are much larger than their
|
|
10
|
+
/// encoded form). This overflows CPython's small main-thread stack on
|
|
11
|
+
/// Windows (and even Rust's default test-thread stack), so run everything on
|
|
12
|
+
/// a thread with a generously reserved stack. Reservation is virtual and
|
|
13
|
+
/// costs nothing until touched.
|
|
14
|
+
const WORKER_STACK_SIZE: usize = 512 * 1024 * 1024;
|
|
15
|
+
|
|
16
|
+
/// Runs `f` on a thread with an enlarged stack.
|
|
17
|
+
///
|
|
18
|
+
/// The closure must be `Send + 'static` and produce a `Send` value, so it cannot
|
|
19
|
+
/// construct `PyErr` (which is not `Send`); do all argument validation on the
|
|
20
|
+
/// calling thread first.
|
|
21
|
+
fn run_isolated<T, F>(f: F) -> PyResult<T>
|
|
22
|
+
where
|
|
23
|
+
F: FnOnce() -> T + Send + 'static,
|
|
24
|
+
T: Send + 'static,
|
|
25
|
+
{
|
|
26
|
+
std::thread::Builder::new()
|
|
27
|
+
.stack_size(WORKER_STACK_SIZE)
|
|
28
|
+
.spawn(f)
|
|
29
|
+
.map_err(|e| PyRuntimeError::new_err(format!("failed to spawn worker thread: {e}")))?
|
|
30
|
+
.join()
|
|
31
|
+
.map_err(|_| PyRuntimeError::new_err("worker thread panicked"))
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/// Generates a (secret_key, public_key) tuple.
|
|
35
|
+
/// Pass is_party_a=True for Party A, or False for Party B.
|
|
36
|
+
///
|
|
37
|
+
/// Note: the key arrays (2 x 221184 bytes) travel back to the calling thread
|
|
38
|
+
/// boxed on the heap. Returning them by value would keep several copies alive
|
|
39
|
+
/// on CPython's small (1 MiB) main-thread stack on Windows and overflow it.
|
|
40
|
+
#[pyfunction]
|
|
41
|
+
fn keygen<'py>(py: Python<'py>, is_party_a: bool) -> PyResult<(&'py PyBytes, &'py PyBytes)> {
|
|
42
|
+
let keys = py.allow_threads(move || {
|
|
43
|
+
run_isolated(move || {
|
|
44
|
+
let (sk, pk) = if is_party_a {
|
|
45
|
+
pswoosh_keygen(&sysA::A, true)
|
|
46
|
+
} else {
|
|
47
|
+
pswoosh_keygen(&sysA::At, false)
|
|
48
|
+
};
|
|
49
|
+
Box::new((sk, pk))
|
|
50
|
+
})
|
|
51
|
+
})?;
|
|
52
|
+
|
|
53
|
+
Ok((PyBytes::new(py, &keys.0), PyBytes::new(py, &keys.1)))
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/// Derives the 32-byte shared secret given (pk1, pk2, sk, is_party_a)
|
|
57
|
+
#[pyfunction]
|
|
58
|
+
fn derive_shared_secret<'py>(
|
|
59
|
+
py: Python<'py>,
|
|
60
|
+
pk1: &[u8],
|
|
61
|
+
pk2: &[u8],
|
|
62
|
+
sk: &[u8],
|
|
63
|
+
is_party_a: bool,
|
|
64
|
+
) -> PyResult<&'py PyBytes> {
|
|
65
|
+
let pk1: &[u8; PUBLICKEY_BYTES] = pk1.try_into().map_err(|_| {
|
|
66
|
+
PyValueError::new_err(format!("pk1 must be exactly {PUBLICKEY_BYTES} bytes"))
|
|
67
|
+
})?;
|
|
68
|
+
let pk2: &[u8; PUBLICKEY_BYTES] = pk2.try_into().map_err(|_| {
|
|
69
|
+
PyValueError::new_err(format!("pk2 must be exactly {PUBLICKEY_BYTES} bytes"))
|
|
70
|
+
})?;
|
|
71
|
+
let sk: &[u8; SECRETKEY_BYTES] = sk.try_into().map_err(|_| {
|
|
72
|
+
PyValueError::new_err(format!("sk must be exactly {SECRETKEY_BYTES} bytes"))
|
|
73
|
+
})?;
|
|
74
|
+
|
|
75
|
+
// Box the inputs so only pointers cross the calling thread's small stack;
|
|
76
|
+
// the worker dereferences them on its own large stack.
|
|
77
|
+
let pk1 = Box::new(*pk1);
|
|
78
|
+
let pk2 = Box::new(*pk2);
|
|
79
|
+
let sk = Box::new(*sk);
|
|
80
|
+
|
|
81
|
+
let shared_secret = py.allow_threads(move || {
|
|
82
|
+
run_isolated(move || pswoosh_skey_deriv(&pk1, &pk2, &sk, is_party_a))
|
|
83
|
+
})?;
|
|
84
|
+
|
|
85
|
+
Ok(PyBytes::new(py, &shared_secret))
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
#[pymodule]
|
|
89
|
+
fn _swoosh(_py: Python, m: &PyModule) -> PyResult<()> {
|
|
90
|
+
m.add_function(wrap_pyfunction!(keygen, m)?)?;
|
|
91
|
+
m.add_function(wrap_pyfunction!(derive_shared_secret, m)?)?;
|
|
92
|
+
Ok(())
|
|
93
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"""Type stubs for swoosh._swoosh (implemented in Rust via PyO3)."""
|
|
2
|
+
|
|
3
|
+
def keygen(is_party_a: bool) -> tuple[bytes, bytes]:
|
|
4
|
+
"""Generate a (secret_key, public_key) pair.
|
|
5
|
+
|
|
6
|
+
Pass True for Party A, False for Party B.
|
|
7
|
+
Both keys are 221184 bytes.
|
|
8
|
+
"""
|
|
9
|
+
...
|
|
10
|
+
|
|
11
|
+
def derive_shared_secret(
|
|
12
|
+
own_pk: bytes,
|
|
13
|
+
other_pk: bytes,
|
|
14
|
+
sk: bytes,
|
|
15
|
+
is_party_a: bool,
|
|
16
|
+
) -> bytes:
|
|
17
|
+
"""Derive the 32-byte shared secret.
|
|
18
|
+
|
|
19
|
+
Each side must pass its *own* public key first:
|
|
20
|
+
A calls (pk_a, pk_b, sk_a, True), B calls (pk_b, pk_a, sk_b, False).
|
|
21
|
+
"""
|
|
22
|
+
...
|