puantum 1.2.3__cp312-cp312-manylinux_2_34_x86_64.whl → 10.0.0.0__cp312-cp312-manylinux_2_34_x86_64.whl
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.
- puantum/__init__.pyi +1 -0
- puantum/__internal__.cpython-312-x86_64-linux-gnu.so +0 -0
- puantum/classic/__init__.pyi +1 -0
- puantum/quantum/__init__.pyi +1 -0
- puantum/quantum/dsa/__init__.pyi +5 -0
- puantum/quantum/dsa/__internal__.pyi +388 -0
- puantum/quantum/kem/__init__.pyi +5 -0
- puantum/quantum/kem/__internal__.pyi +363 -0
- {puantum-1.2.3.dist-info → puantum-10.0.0.0.dist-info}/METADATA +41 -8
- puantum-10.0.0.0.dist-info/RECORD +19 -0
- puantum-1.2.3.dist-info/RECORD +0 -12
- {puantum-1.2.3.dist-info → puantum-10.0.0.0.dist-info}/WHEEL +0 -0
- /puantum-1.2.3.dist-info/licenses/license.md → /puantum-10.0.0.0.dist-info/licenses/LICENSE +0 -0
puantum/__init__.pyi
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# EMPTY
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
# EMPTY
|
@@ -0,0 +1 @@
|
|
1
|
+
# EMPTY
|
@@ -0,0 +1,388 @@
|
|
1
|
+
# IMPORT
|
2
|
+
import typing as _typing
|
3
|
+
import enum as _enum
|
4
|
+
|
5
|
+
# MAIN
|
6
|
+
class Algorithm:
|
7
|
+
class CROSS(_enum.Enum):
|
8
|
+
CROSSR128B = ...
|
9
|
+
CROSSR128F = ...
|
10
|
+
CROSSR128S = ...
|
11
|
+
CROSSR192B = ...
|
12
|
+
CROSSR192F = ...
|
13
|
+
CROSSR192S = ...
|
14
|
+
CROSSR256B = ...
|
15
|
+
CROSSR256F = ...
|
16
|
+
CROSSR256S = ...
|
17
|
+
CROSSRG128B = ...
|
18
|
+
CROSSRG128F = ...
|
19
|
+
CROSSRG128S = ...
|
20
|
+
CROSSRG192B = ...
|
21
|
+
CROSSRG192F = ...
|
22
|
+
CROSSRG192S = ...
|
23
|
+
CROSSRG256B = ...
|
24
|
+
CROSSRG256F = ...
|
25
|
+
CROSSRG256S = ...
|
26
|
+
#
|
27
|
+
class DILITHIUM(_enum.Enum):
|
28
|
+
DILITHIUM2 = ...
|
29
|
+
DILITHIUM3 = ...
|
30
|
+
DILITHIUM5 = ...
|
31
|
+
#
|
32
|
+
class FALCON(_enum.Enum):
|
33
|
+
FALCON512 = ...
|
34
|
+
FALCON1024 = ...
|
35
|
+
#
|
36
|
+
class MAYO(_enum.Enum):
|
37
|
+
MAYO1 = ...
|
38
|
+
MAYO2 = ...
|
39
|
+
MAYO3 = ...
|
40
|
+
MAYO5 = ...
|
41
|
+
#
|
42
|
+
class MLDSA(_enum.Enum):
|
43
|
+
MLDSA44 = ...
|
44
|
+
MLDSA65 = ...
|
45
|
+
MLDSA87 = ...
|
46
|
+
#
|
47
|
+
class SPHINCS(_enum.Enum):
|
48
|
+
SHA2128F = ...
|
49
|
+
SHA2128S = ...
|
50
|
+
SHA2192F = ...
|
51
|
+
SHA2192S = ...
|
52
|
+
SHA2256F = ...
|
53
|
+
SHA2256S = ...
|
54
|
+
SHAKE128F = ...
|
55
|
+
SHAKE128S = ...
|
56
|
+
SHAKE192F = ...
|
57
|
+
SHAKE192S = ...
|
58
|
+
SHAKE256F = ...
|
59
|
+
SHAKE256S = ...
|
60
|
+
#
|
61
|
+
class UOV(_enum.Enum):
|
62
|
+
UOVOVIII = ...
|
63
|
+
UOVOVIIIPKC = ...
|
64
|
+
UOVOVIIIPKCSKC = ...
|
65
|
+
UOVOVIP = ...
|
66
|
+
UOVOVIPPKC = ...
|
67
|
+
UOVOVIPPKCSKC = ...
|
68
|
+
UOVOVIS = ...
|
69
|
+
UOVOVISPKC = ...
|
70
|
+
UOVOVISPKCSKC = ...
|
71
|
+
UOVOVV = ...
|
72
|
+
UOVOVVPKC = ...
|
73
|
+
UOVOVVPKCSKC = ...
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
class PublicKey:
|
78
|
+
def __init__(self, publickey: bytes) -> None:
|
79
|
+
...
|
80
|
+
#
|
81
|
+
def verify(self, signature: _typing.Any, message: _typing.Any) -> _typing.Any:
|
82
|
+
...
|
83
|
+
|
84
|
+
|
85
|
+
|
86
|
+
class CROSSPublicKey(PublicKey):
|
87
|
+
def __init__(self, name: Algorithm.CROSS, publickey: bytes) -> None:
|
88
|
+
...
|
89
|
+
#
|
90
|
+
def verify(self, signature: bytes, message: bytes) -> bool:
|
91
|
+
...
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
class DILITHIUMPublicKey(PublicKey):
|
96
|
+
def __init__(self, name: Algorithm.DILITHIUM, publickey: bytes) -> None:
|
97
|
+
...
|
98
|
+
#
|
99
|
+
def verify(self, signature: bytes, message: bytes) -> bool:
|
100
|
+
...
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
class FALCONPublicKey(PublicKey):
|
105
|
+
def __init__(self, name: Algorithm.FALCON, publickey: bytes) -> None:
|
106
|
+
...
|
107
|
+
#
|
108
|
+
def verify(self, signature: bytes, message: bytes) -> bool:
|
109
|
+
...
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
class MAYOPublicKey(PublicKey):
|
114
|
+
def __init__(self, name: Algorithm.MAYO, publickey: bytes) -> None:
|
115
|
+
...
|
116
|
+
#
|
117
|
+
def verify(self, signature: bytes, message: bytes) -> bool:
|
118
|
+
...
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
class MLDSAPublicKey(PublicKey):
|
123
|
+
def __init__(self, name: Algorithm.MLDSA, publickey: bytes) -> None:
|
124
|
+
...
|
125
|
+
#
|
126
|
+
def verify(self, signature: bytes, message: bytes) -> bool:
|
127
|
+
...
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
class SPHINCSPublicKey(PublicKey):
|
132
|
+
def __init__(self, name: Algorithm.SPHINCS, publickey: bytes) -> None:
|
133
|
+
...
|
134
|
+
#
|
135
|
+
def verify(self, signature: bytes, message: bytes) -> bool:
|
136
|
+
...
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
class UOVPublicKey(PublicKey):
|
141
|
+
def __init__(self, name: Algorithm.UOV, publickey: bytes) -> None:
|
142
|
+
...
|
143
|
+
#
|
144
|
+
def verify(self, signature: bytes, message: bytes) -> bool:
|
145
|
+
...
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
class SecretKey:
|
150
|
+
def __init__(self, secretkey: bytes) -> None:
|
151
|
+
...
|
152
|
+
#
|
153
|
+
def sign(self, message: _typing.Any) -> _typing.Any:
|
154
|
+
...
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
class CROSSSecretKey(SecretKey):
|
159
|
+
def __init__(self, name: Algorithm.CROSS, secretkey: bytes) -> None:
|
160
|
+
...
|
161
|
+
#
|
162
|
+
def sign(self, message: bytes) -> bytes:
|
163
|
+
...
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
class DILITHIUMSecretKey(SecretKey):
|
168
|
+
def __init__(self, name: Algorithm.DILITHIUM, secretkey: bytes) -> None:
|
169
|
+
...
|
170
|
+
#
|
171
|
+
def sign(self, message: bytes) -> bytes:
|
172
|
+
...
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
class FALCONSecretKey(SecretKey):
|
177
|
+
def __init__(self, name: Algorithm.FALCON, secretkey: bytes) -> None:
|
178
|
+
...
|
179
|
+
#
|
180
|
+
def sign(self, message: bytes) -> bytes:
|
181
|
+
...
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
class MAYOSecretKey(SecretKey):
|
186
|
+
def __init__(self, name: Algorithm.MAYO, secretkey: bytes) -> None:
|
187
|
+
...
|
188
|
+
#
|
189
|
+
def sign(self, message: bytes) -> bytes:
|
190
|
+
...
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
class MLDSASecretKey(SecretKey):
|
195
|
+
def __init__(self, name: Algorithm.MLDSA, secretkey: bytes) -> None:
|
196
|
+
...
|
197
|
+
#
|
198
|
+
def sign(self, message: bytes) -> bytes:
|
199
|
+
...
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
class SPHINCSSecretKey(SecretKey):
|
204
|
+
def __init__(self, name: Algorithm.SPHINCS, secretkey: bytes) -> None:
|
205
|
+
...
|
206
|
+
#
|
207
|
+
def sign(self, message: bytes) -> bytes:
|
208
|
+
...
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
class UOVSecretKey(SecretKey):
|
213
|
+
def __init__(self, name: Algorithm.UOV, secretkey: bytes) -> None:
|
214
|
+
...
|
215
|
+
#
|
216
|
+
def sign(self, message: bytes) -> bytes:
|
217
|
+
...
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
@_typing.overload
|
222
|
+
def KeyPair(
|
223
|
+
name: Algorithm,
|
224
|
+
*,
|
225
|
+
secretkey: bytes,
|
226
|
+
publickey: bytes
|
227
|
+
) -> tuple[SecretKey, PublicKey]:
|
228
|
+
...
|
229
|
+
@_typing.overload
|
230
|
+
def KeyPair(name: Algorithm, *, secretkey: bytes) -> SecretKey:
|
231
|
+
...
|
232
|
+
@_typing.overload
|
233
|
+
def KeyPair(name: Algorithm, *, publickey: bytes) -> PublicKey:
|
234
|
+
...
|
235
|
+
@_typing.overload
|
236
|
+
def KeyPair(name: Algorithm) -> tuple[SecretKey, PublicKey]:
|
237
|
+
...
|
238
|
+
|
239
|
+
|
240
|
+
|
241
|
+
@_typing.overload
|
242
|
+
def KeyPair(
|
243
|
+
name: Algorithm.CROSS,
|
244
|
+
*,
|
245
|
+
secretkey: bytes,
|
246
|
+
publickey: bytes
|
247
|
+
) -> tuple[CROSSSecretKey, CROSSPublicKey]:
|
248
|
+
...
|
249
|
+
@_typing.overload
|
250
|
+
def KeyPair(name: Algorithm.CROSS, *, secretkey: bytes) -> CROSSSecretKey:
|
251
|
+
...
|
252
|
+
@_typing.overload
|
253
|
+
def KeyPair(name: Algorithm.CROSS, *, publickey: bytes) -> CROSSPublicKey:
|
254
|
+
...
|
255
|
+
@_typing.overload
|
256
|
+
def KeyPair(name: Algorithm.CROSS) -> tuple[CROSSSecretKey, CROSSPublicKey]:
|
257
|
+
...
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
@_typing.overload
|
262
|
+
def KeyPair(
|
263
|
+
name: Algorithm.DILITHIUM,
|
264
|
+
*,
|
265
|
+
secretkey: bytes,
|
266
|
+
publickey: bytes
|
267
|
+
) -> tuple[DILITHIUMSecretKey, DILITHIUMPublicKey]:
|
268
|
+
...
|
269
|
+
@_typing.overload
|
270
|
+
def KeyPair(name: Algorithm.DILITHIUM, *, secretkey: bytes) -> DILITHIUMSecretKey:
|
271
|
+
...
|
272
|
+
@_typing.overload
|
273
|
+
def KeyPair(name: Algorithm.DILITHIUM, *, publickey: bytes) -> DILITHIUMPublicKey:
|
274
|
+
...
|
275
|
+
@_typing.overload
|
276
|
+
def KeyPair(name: Algorithm.DILITHIUM) -> tuple[DILITHIUMSecretKey, DILITHIUMPublicKey]:
|
277
|
+
...
|
278
|
+
|
279
|
+
|
280
|
+
|
281
|
+
@_typing.overload
|
282
|
+
def KeyPair(
|
283
|
+
name: Algorithm.FALCON,
|
284
|
+
*,
|
285
|
+
secretkey: bytes,
|
286
|
+
publickey: bytes
|
287
|
+
) -> tuple[FALCONSecretKey, FALCONPublicKey]:
|
288
|
+
...
|
289
|
+
@_typing.overload
|
290
|
+
def KeyPair(name: Algorithm.FALCON, *, secretkey: bytes) -> FALCONSecretKey:
|
291
|
+
...
|
292
|
+
@_typing.overload
|
293
|
+
def KeyPair(name: Algorithm.FALCON, *, publickey: bytes) -> FALCONPublicKey:
|
294
|
+
...
|
295
|
+
@_typing.overload
|
296
|
+
def KeyPair(name: Algorithm.FALCON) -> tuple[FALCONSecretKey, FALCONPublicKey]:
|
297
|
+
...
|
298
|
+
|
299
|
+
|
300
|
+
|
301
|
+
@_typing.overload
|
302
|
+
def KeyPair(
|
303
|
+
name: Algorithm.MAYO,
|
304
|
+
*,
|
305
|
+
secretkey: bytes,
|
306
|
+
publickey: bytes
|
307
|
+
) -> tuple[MAYOSecretKey, MAYOPublicKey]:
|
308
|
+
...
|
309
|
+
@_typing.overload
|
310
|
+
def KeyPair(name: Algorithm.MAYO, *, secretkey: bytes) -> MAYOSecretKey:
|
311
|
+
...
|
312
|
+
@_typing.overload
|
313
|
+
def KeyPair(name: Algorithm.MAYO, *, publickey: bytes) -> MAYOPublicKey:
|
314
|
+
...
|
315
|
+
@_typing.overload
|
316
|
+
def KeyPair(name: Algorithm.MAYO) -> tuple[MAYOSecretKey, MAYOPublicKey]:
|
317
|
+
...
|
318
|
+
|
319
|
+
|
320
|
+
|
321
|
+
@_typing.overload
|
322
|
+
def KeyPair(
|
323
|
+
name: Algorithm.MLDSA,
|
324
|
+
*,
|
325
|
+
secretkey: bytes,
|
326
|
+
publickey: bytes
|
327
|
+
) -> tuple[MLDSASecretKey, MLDSAPublicKey]:
|
328
|
+
...
|
329
|
+
@_typing.overload
|
330
|
+
def KeyPair(name: Algorithm.MLDSA, *, secretkey: bytes) -> MLDSASecretKey:
|
331
|
+
...
|
332
|
+
@_typing.overload
|
333
|
+
def KeyPair(name: Algorithm.MLDSA, *, publickey: bytes) -> MLDSAPublicKey:
|
334
|
+
...
|
335
|
+
@_typing.overload
|
336
|
+
def KeyPair(name: Algorithm.MLDSA) -> tuple[MLDSASecretKey, MLDSAPublicKey]:
|
337
|
+
...
|
338
|
+
|
339
|
+
|
340
|
+
|
341
|
+
@_typing.overload
|
342
|
+
def KeyPair(
|
343
|
+
name: Algorithm.SPHINCS,
|
344
|
+
*,
|
345
|
+
secretkey: bytes,
|
346
|
+
publickey: bytes
|
347
|
+
) -> tuple[SPHINCSSecretKey, SPHINCSPublicKey]:
|
348
|
+
...
|
349
|
+
@_typing.overload
|
350
|
+
def KeyPair(name: Algorithm.SPHINCS, *, secretkey: bytes) -> SPHINCSSecretKey:
|
351
|
+
...
|
352
|
+
@_typing.overload
|
353
|
+
def KeyPair(name: Algorithm.SPHINCS, *, publickey: bytes) -> SPHINCSPublicKey:
|
354
|
+
...
|
355
|
+
@_typing.overload
|
356
|
+
def KeyPair(name: Algorithm.SPHINCS) -> tuple[SPHINCSSecretKey, SPHINCSPublicKey]:
|
357
|
+
...
|
358
|
+
|
359
|
+
|
360
|
+
|
361
|
+
@_typing.overload
|
362
|
+
def KeyPair(
|
363
|
+
name: Algorithm.UOV,
|
364
|
+
*,
|
365
|
+
secretkey: bytes,
|
366
|
+
publickey: bytes
|
367
|
+
) -> tuple[UOVSecretKey, UOVPublicKey]:
|
368
|
+
...
|
369
|
+
@_typing.overload
|
370
|
+
def KeyPair(name: Algorithm.UOV, *, secretkey: bytes) -> UOVSecretKey:
|
371
|
+
...
|
372
|
+
@_typing.overload
|
373
|
+
def KeyPair(name: Algorithm.UOV, *, publickey: bytes) -> UOVPublicKey:
|
374
|
+
...
|
375
|
+
@_typing.overload
|
376
|
+
def KeyPair(name: Algorithm.UOV) -> tuple[UOVSecretKey, UOVPublicKey]:
|
377
|
+
...
|
378
|
+
|
379
|
+
|
380
|
+
|
381
|
+
Algorithms = Algorithm.CROSS | Algorithm.DILITHIUM | Algorithm.FALCON | Algorithm.MAYO | Algorithm.MLDSA | Algorithm.SPHINCS | Algorithm.UOV
|
382
|
+
def KeyPair(
|
383
|
+
name: Algorithm | Algorithms,
|
384
|
+
*,
|
385
|
+
secretkey: bytes | None = ...,
|
386
|
+
publickey: bytes | None = ...
|
387
|
+
) -> tuple[SecretKey, PublicKey] | SecretKey | PublicKey:
|
388
|
+
...
|
@@ -0,0 +1,363 @@
|
|
1
|
+
# IMPORT
|
2
|
+
import typing as _typing
|
3
|
+
import enum as _enum
|
4
|
+
|
5
|
+
# MAIN
|
6
|
+
class Algorithm:
|
7
|
+
class BIKE(_enum.Enum):
|
8
|
+
BIKEL1 = ...
|
9
|
+
BIKEL3 = ...
|
10
|
+
BIKEL5 = ...
|
11
|
+
#
|
12
|
+
class CLASSICMCELIECE(_enum.Enum):
|
13
|
+
CLASSICMCELIECE348864 = ...
|
14
|
+
CLASSICMCELIECE348864F = ...
|
15
|
+
CLASSICMCELIECE460896 = ...
|
16
|
+
CLASSICMCELIECE460896F = ...
|
17
|
+
CLASSICMCELIECE6688128 = ...
|
18
|
+
CLASSICMCELIECE6688128F = ...
|
19
|
+
CLASSICMCELIECE6960119 = ...
|
20
|
+
CLASSICMCELIECE6960119F = ...
|
21
|
+
CLASSICMCELIECE8192128 = ...
|
22
|
+
CLASSICMCELIECE8192128F = ...
|
23
|
+
#
|
24
|
+
class HQC(_enum.Enum):
|
25
|
+
HQC128 = ...
|
26
|
+
HQC192 = ...
|
27
|
+
HQC256 = ...
|
28
|
+
#
|
29
|
+
class KYBER(_enum.Enum):
|
30
|
+
KYBER512 = ...
|
31
|
+
KYBER768 = ...
|
32
|
+
KYBER1024 = ...
|
33
|
+
#
|
34
|
+
class MLKEM(_enum.Enum):
|
35
|
+
MLKEM512 = ...
|
36
|
+
MLKEM768 = ...
|
37
|
+
MLKEM1024 = ...
|
38
|
+
#
|
39
|
+
class NTRUPRIME(_enum.Enum):
|
40
|
+
NTRUPRIME = ...
|
41
|
+
#
|
42
|
+
class FRODOKEM(_enum.Enum):
|
43
|
+
FRODOKEM640AES = ...
|
44
|
+
FRODOKEM640SHAKE = ...
|
45
|
+
FRODOKEM976AES = ...
|
46
|
+
FRODOKEM976SHAKE = ...
|
47
|
+
FRODOKEM1344AES = ...
|
48
|
+
FRODOKEM1344SHAKE = ...
|
49
|
+
|
50
|
+
|
51
|
+
|
52
|
+
class PublicKey:
|
53
|
+
def __init__(self, publickey: bytes) -> None:
|
54
|
+
...
|
55
|
+
#
|
56
|
+
def encapsulate(self) -> tuple[_typing.Any, _typing.Any]:
|
57
|
+
...
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
class BIKEPublicKey(PublicKey):
|
62
|
+
def __init__(self, name: Algorithm.BIKE, publickey: bytes) -> None:
|
63
|
+
...
|
64
|
+
#
|
65
|
+
def encapsulate(self) -> tuple[bytes, bytes]:
|
66
|
+
...
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
class CLASSICMCELIECEPublicKey(PublicKey):
|
71
|
+
def __init__(self, name: Algorithm.CLASSICMCELIECE, publickey: bytes) -> None:
|
72
|
+
...
|
73
|
+
#
|
74
|
+
def encapsulate(self) -> tuple[bytes, bytes]:
|
75
|
+
...
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
class HQCPublicKey(PublicKey):
|
80
|
+
def __init__(self, name: Algorithm.HQC, publickey: bytes) -> None:
|
81
|
+
...
|
82
|
+
#
|
83
|
+
def encapsulate(self) -> tuple[bytes, bytes]:
|
84
|
+
...
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
class KYBERPublicKey(PublicKey):
|
89
|
+
def __init__(self, name: Algorithm.KYBER, publickey: bytes) -> None:
|
90
|
+
...
|
91
|
+
#
|
92
|
+
def encapsulate(self) -> tuple[bytes, bytes]:
|
93
|
+
...
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
class MLKEMPublicKey(PublicKey):
|
98
|
+
def __init__(self, name: Algorithm.MLKEM, publickey: bytes) -> None:
|
99
|
+
...
|
100
|
+
|
101
|
+
def encapsulate(self) -> tuple[bytes, bytes]:
|
102
|
+
...
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
class NTRUPRIMEPublicKey(PublicKey):
|
107
|
+
def __init__(self, name: Algorithm.NTRUPRIME, publickey: bytes) -> None:
|
108
|
+
...
|
109
|
+
#
|
110
|
+
def encapsulate(self) -> tuple[bytes, bytes]:
|
111
|
+
...
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
class FRODOKEMPublicKey(PublicKey):
|
116
|
+
def __init__(self, name: Algorithm.FRODOKEM, publickey: bytes) -> None:
|
117
|
+
...
|
118
|
+
#
|
119
|
+
def encapsulate(self) -> tuple[bytes, bytes]:
|
120
|
+
...
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
class SecretKey:
|
125
|
+
def __init__(self, secretkey: bytes) -> None:
|
126
|
+
...
|
127
|
+
#
|
128
|
+
def decapsulate(self, ciphertext: _typing.Any) -> _typing.Any:
|
129
|
+
...
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
class BIKESecretKey(SecretKey):
|
134
|
+
def __init__(self, name: Algorithm.BIKE, secretkey: bytes) -> None:
|
135
|
+
...
|
136
|
+
#
|
137
|
+
def decapsulate(self, ciphertext: bytes) -> bytes:
|
138
|
+
...
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
class CLASSICMCELIECESecretKey(SecretKey):
|
143
|
+
def __init__(self, name: Algorithm.CLASSICMCELIECE, secretkey: bytes) -> None:
|
144
|
+
...
|
145
|
+
#
|
146
|
+
def decapsulate(self, ciphertext: bytes) -> bytes:
|
147
|
+
...
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
class HQCSecretKey(SecretKey):
|
152
|
+
def __init__(self, name: Algorithm.HQC, secretkey: bytes) -> None:
|
153
|
+
...
|
154
|
+
#
|
155
|
+
def decapsulate(self, ciphertext: bytes) -> bytes:
|
156
|
+
...
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
class KYBERSecretKey(SecretKey):
|
161
|
+
def __init__(self, name: Algorithm.KYBER, secretkey: bytes) -> None:
|
162
|
+
...
|
163
|
+
#
|
164
|
+
def decapsulate(self, ciphertext: bytes) -> bytes:
|
165
|
+
...
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
class MLKEMSecretKey(SecretKey):
|
170
|
+
def __init__(self, name: Algorithm.MLKEM, secretkey: bytes) -> None:
|
171
|
+
...
|
172
|
+
#
|
173
|
+
def decapsulate(self, ciphertext: bytes) -> bytes:
|
174
|
+
...
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
class NTRUPRIMESecretKey(SecretKey):
|
179
|
+
def __init__(self, name: Algorithm.NTRUPRIME, secretkey: bytes) -> None:
|
180
|
+
...
|
181
|
+
#
|
182
|
+
def decapsulate(self, ciphertext: bytes) -> bytes:
|
183
|
+
...
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
class FRODOKEMSecretKey(SecretKey):
|
188
|
+
def __init__(self, name: Algorithm.FRODOKEM, secretkey: bytes) -> None:
|
189
|
+
...
|
190
|
+
#
|
191
|
+
def decapsulate(self, ciphertext: bytes) -> bytes:
|
192
|
+
...
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
@_typing.overload
|
197
|
+
def KeyPair(
|
198
|
+
name: Algorithm,
|
199
|
+
*,
|
200
|
+
secretkey: bytes,
|
201
|
+
publickey: bytes
|
202
|
+
) -> tuple[SecretKey, PublicKey]:
|
203
|
+
...
|
204
|
+
@_typing.overload
|
205
|
+
def KeyPair(name: Algorithm, *, secretkey: bytes) -> SecretKey:
|
206
|
+
...
|
207
|
+
@_typing.overload
|
208
|
+
def KeyPair(name: Algorithm, *, publickey: bytes) -> PublicKey:
|
209
|
+
...
|
210
|
+
@_typing.overload
|
211
|
+
def KeyPair(name: Algorithm) -> tuple[SecretKey, PublicKey]:
|
212
|
+
...
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
@_typing.overload
|
217
|
+
def KeyPair(
|
218
|
+
name: Algorithm.BIKE,
|
219
|
+
*,
|
220
|
+
secretkey: bytes,
|
221
|
+
publickey: bytes
|
222
|
+
) -> tuple[BIKESecretKey, BIKEPublicKey]:
|
223
|
+
...
|
224
|
+
@_typing.overload
|
225
|
+
def KeyPair(name: Algorithm.BIKE, *, secretkey: bytes) -> BIKESecretKey:
|
226
|
+
...
|
227
|
+
@_typing.overload
|
228
|
+
def KeyPair(name: Algorithm.BIKE, *, publickey: bytes) -> BIKEPublicKey:
|
229
|
+
...
|
230
|
+
@_typing.overload
|
231
|
+
def KeyPair(name: Algorithm.BIKE) -> tuple[BIKESecretKey, BIKEPublicKey]:
|
232
|
+
...
|
233
|
+
|
234
|
+
|
235
|
+
|
236
|
+
@_typing.overload
|
237
|
+
def KeyPair(
|
238
|
+
name: Algorithm.CLASSICMCELIECE,
|
239
|
+
*,
|
240
|
+
secretkey: bytes,
|
241
|
+
publickey: bytes
|
242
|
+
) -> tuple[CLASSICMCELIECESecretKey, CLASSICMCELIECEPublicKey]:
|
243
|
+
...
|
244
|
+
@_typing.overload
|
245
|
+
def KeyPair(name: Algorithm.CLASSICMCELIECE, *, secretkey: bytes) -> CLASSICMCELIECESecretKey:
|
246
|
+
...
|
247
|
+
@_typing.overload
|
248
|
+
def KeyPair(name: Algorithm.CLASSICMCELIECE, *, publickey: bytes) -> CLASSICMCELIECEPublicKey:
|
249
|
+
...
|
250
|
+
@_typing.overload
|
251
|
+
def KeyPair(name: Algorithm.CLASSICMCELIECE) -> tuple[CLASSICMCELIECESecretKey, CLASSICMCELIECEPublicKey]:
|
252
|
+
...
|
253
|
+
|
254
|
+
|
255
|
+
|
256
|
+
@_typing.overload
|
257
|
+
def KeyPair(
|
258
|
+
name: Algorithm.HQC,
|
259
|
+
*,
|
260
|
+
secretkey: bytes,
|
261
|
+
publickey: bytes
|
262
|
+
) -> tuple[HQCSecretKey, HQCPublicKey]:
|
263
|
+
...
|
264
|
+
@_typing.overload
|
265
|
+
def KeyPair(name: Algorithm.HQC, *, secretkey: bytes) -> HQCSecretKey:
|
266
|
+
...
|
267
|
+
@_typing.overload
|
268
|
+
def KeyPair(name: Algorithm.HQC, *, publickey: bytes) -> HQCPublicKey:
|
269
|
+
...
|
270
|
+
@_typing.overload
|
271
|
+
def KeyPair(name: Algorithm.HQC) -> tuple[HQCSecretKey, HQCPublicKey]:
|
272
|
+
...
|
273
|
+
|
274
|
+
|
275
|
+
|
276
|
+
@_typing.overload
|
277
|
+
def KeyPair(
|
278
|
+
name: Algorithm.KYBER,
|
279
|
+
*,
|
280
|
+
secretkey: bytes,
|
281
|
+
publickey: bytes
|
282
|
+
) -> tuple[KYBERSecretKey, KYBERPublicKey]:
|
283
|
+
...
|
284
|
+
@_typing.overload
|
285
|
+
def KeyPair(name: Algorithm.KYBER, *, secretkey: bytes) -> KYBERSecretKey:
|
286
|
+
...
|
287
|
+
@_typing.overload
|
288
|
+
def KeyPair(name: Algorithm.KYBER, *, publickey: bytes) -> KYBERPublicKey:
|
289
|
+
...
|
290
|
+
@_typing.overload
|
291
|
+
def KeyPair(name: Algorithm.KYBER) -> tuple[KYBERSecretKey, KYBERPublicKey]:
|
292
|
+
...
|
293
|
+
|
294
|
+
|
295
|
+
|
296
|
+
@_typing.overload
|
297
|
+
def KeyPair(
|
298
|
+
name: Algorithm.MLKEM,
|
299
|
+
*,
|
300
|
+
secretkey: bytes,
|
301
|
+
publickey: bytes
|
302
|
+
) -> tuple[MLKEMSecretKey, MLKEMPublicKey]:
|
303
|
+
...
|
304
|
+
@_typing.overload
|
305
|
+
def KeyPair(name: Algorithm.MLKEM, *, secretkey: bytes) -> MLKEMSecretKey:
|
306
|
+
...
|
307
|
+
@_typing.overload
|
308
|
+
def KeyPair(name: Algorithm.MLKEM, *, publickey: bytes) -> MLKEMPublicKey:
|
309
|
+
...
|
310
|
+
@_typing.overload
|
311
|
+
def KeyPair(name: Algorithm.MLKEM) -> tuple[MLKEMSecretKey, MLKEMPublicKey]:
|
312
|
+
...
|
313
|
+
|
314
|
+
|
315
|
+
|
316
|
+
@_typing.overload
|
317
|
+
def KeyPair(
|
318
|
+
name: Algorithm.NTRUPRIME,
|
319
|
+
*,
|
320
|
+
secretkey: bytes,
|
321
|
+
publickey: bytes
|
322
|
+
) -> tuple[NTRUPRIMESecretKey, NTRUPRIMEPublicKey]:
|
323
|
+
...
|
324
|
+
@_typing.overload
|
325
|
+
def KeyPair(name: Algorithm.NTRUPRIME, *, secretkey: bytes) -> NTRUPRIMESecretKey:
|
326
|
+
...
|
327
|
+
@_typing.overload
|
328
|
+
def KeyPair(name: Algorithm.NTRUPRIME, *, publickey: bytes) -> NTRUPRIMEPublicKey:
|
329
|
+
...
|
330
|
+
@_typing.overload
|
331
|
+
def KeyPair(name: Algorithm.NTRUPRIME) -> tuple[NTRUPRIMESecretKey, NTRUPRIMEPublicKey]:
|
332
|
+
...
|
333
|
+
|
334
|
+
|
335
|
+
|
336
|
+
@_typing.overload
|
337
|
+
def KeyPair(
|
338
|
+
name: Algorithm.FRODOKEM,
|
339
|
+
*,
|
340
|
+
secretkey: bytes,
|
341
|
+
publickey: bytes
|
342
|
+
) -> tuple[FRODOKEMSecretKey, FRODOKEMPublicKey]:
|
343
|
+
...
|
344
|
+
@_typing.overload
|
345
|
+
def KeyPair(name: Algorithm.FRODOKEM, *, secretkey: bytes) -> FRODOKEMSecretKey:
|
346
|
+
...
|
347
|
+
@_typing.overload
|
348
|
+
def KeyPair(name: Algorithm.FRODOKEM, *, publickey: bytes) -> FRODOKEMPublicKey:
|
349
|
+
...
|
350
|
+
@_typing.overload
|
351
|
+
def KeyPair(name: Algorithm.FRODOKEM) -> tuple[FRODOKEMSecretKey, FRODOKEMPublicKey]:
|
352
|
+
...
|
353
|
+
|
354
|
+
|
355
|
+
|
356
|
+
Algorithms = Algorithm.BIKE | Algorithm.CLASSICMCELIECE | Algorithm.HQC | Algorithm.KYBER | Algorithm.MLKEM | Algorithm.NTRUPRIME | Algorithm.FRODOKEM
|
357
|
+
def KeyPair(
|
358
|
+
name: Algorithm | Algorithms,
|
359
|
+
*,
|
360
|
+
secretkey: bytes | None = ...,
|
361
|
+
publickey: bytes | None = ...
|
362
|
+
) -> tuple[SecretKey, PublicKey] | SecretKey | PublicKey:
|
363
|
+
...
|
@@ -1,12 +1,11 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: puantum
|
3
|
-
Version:
|
3
|
+
Version: 10.0.0.0
|
4
4
|
Classifier: Programming Language :: Python :: 3
|
5
5
|
Classifier: Programming Language :: Rust
|
6
6
|
Classifier: Operating System :: OS Independent
|
7
|
-
Classifier: License :: Public Domain
|
8
7
|
Classifier: License :: OSI Approved :: The Unlicense (Unlicense)
|
9
|
-
License-File:
|
8
|
+
License-File: LICENSE
|
10
9
|
Summary: Python Cryptography
|
11
10
|
Keywords: python,cryptography,quantum,security
|
12
11
|
Author-email: Anonymous <217687495+1xfakebit@users.noreply.github.com>
|
@@ -19,7 +18,7 @@ Project-URL: x, https://x.com/1xfakebit
|
|
19
18
|
|
20
19
|
A blazing-fast cryptography library for Python, built on Rust.
|
21
20
|
|
22
|
-
|
21
|
+
Pryptography supports an extensive set of **post-quantum** digital signature algorithms (DSA) and key encapsulation mechanisms (KEM).
|
23
22
|
|
24
23
|
---
|
25
24
|
## ⚡ Features
|
@@ -48,15 +47,49 @@ Puantum supports an extensive set of **post-quantum** key encapsulation mechanis
|
|
48
47
|
- #### Sphincs
|
49
48
|
- #### Uov
|
50
49
|
|
51
|
-
###
|
52
|
-
|
53
|
-
|
54
|
-
|
50
|
+
### ❔ Examples
|
51
|
+
|
52
|
+
#### DSA Example
|
53
|
+
```python
|
54
|
+
# IMPORT
|
55
|
+
from puantum.quantum.dsa import Algorithm, KeyPair
|
56
|
+
|
57
|
+
# MAIN
|
58
|
+
alicesk, alicepk = KeyPair(Algorithm.MLDSA.MLDSA87)
|
59
|
+
message = "Hello".encode()
|
60
|
+
|
61
|
+
signature = alicesk.sign(message=message)
|
62
|
+
valid = alicepk.verify(signature=signature, message=message)
|
63
|
+
|
64
|
+
assert valid, "Signature verification failed!"
|
65
|
+
|
66
|
+
print(f"Message: [{message.decode()}]")
|
67
|
+
print(f"Signature: [{signature.hex()[:len(message)]}]")
|
68
|
+
```
|
69
|
+
|
70
|
+
#### KEM Example
|
71
|
+
```python
|
72
|
+
# IMPORT
|
73
|
+
from puantum.quantum.kem import Algorithm, KeyPair
|
74
|
+
|
75
|
+
# MAIN
|
76
|
+
alicesk, alicepk = KeyPair(Algorithm.MLKEM.MLKEM1024)
|
77
|
+
_bobsk, _bobpk = KeyPair(Algorithm.MLKEM.MLKEM1024)
|
78
|
+
|
79
|
+
bobss, bobct = alicepk.encapsulate()
|
80
|
+
alicess = alicesk.decapsulate(bobct)
|
81
|
+
|
82
|
+
assert alicess == bobss, "Shared secrets do not match!"
|
83
|
+
|
84
|
+
print(f"Alice's Shared Secret: [{alicess.hex()}]")
|
85
|
+
print(f"Bob's Shared Secret: [{bobss.hex()}]")
|
86
|
+
```
|
55
87
|
|
56
88
|
### 📦 Install
|
57
89
|
```shell
|
58
90
|
pip install puantum
|
59
91
|
```
|
92
|
+
|
60
93
|
#### or from source:
|
61
94
|
```shell
|
62
95
|
make python
|
@@ -0,0 +1,19 @@
|
|
1
|
+
puantum-10.0.0.0.dist-info/METADATA,sha256=JLVdQmQagYKpkpvx2hvQvr5X8Kdi6LpNIJMgGAfYJx8,2233
|
2
|
+
puantum-10.0.0.0.dist-info/WHEEL,sha256=IPzRd0nigP4r3GK-lmtM2DKCRPiRfyNhNj4tmNbAOTQ,108
|
3
|
+
puantum-10.0.0.0.dist-info/licenses/LICENSE,sha256=tQZYOMusRS38hVum5uAxSBrSxoQG9w0h6tkyE3RlPmw,1212
|
4
|
+
puantum/__init__.py,sha256=DqzIK80d6ihVj9p2qBPJwBjM0V3kl6MRRjKowVB61Ak,8
|
5
|
+
puantum/__init__.pyi,sha256=DqzIK80d6ihVj9p2qBPJwBjM0V3kl6MRRjKowVB61Ak,8
|
6
|
+
puantum/__internal__.cpython-312-x86_64-linux-gnu.so,sha256=Fvl2QkLcOoKgw3ZdvmHHC3x5bbN_yP_Fr3dY5IRl8Pc,8279488
|
7
|
+
puantum/classic/__init__.py,sha256=Dlr1m0uJio3HWH8_gkdhnQS87KUZfUw5wX4tXQtbvWQ,35
|
8
|
+
puantum/classic/__init__.pyi,sha256=DqzIK80d6ihVj9p2qBPJwBjM0V3kl6MRRjKowVB61Ak,8
|
9
|
+
puantum/quantum/__init__.py,sha256=DqzIK80d6ihVj9p2qBPJwBjM0V3kl6MRRjKowVB61Ak,8
|
10
|
+
puantum/quantum/__init__.pyi,sha256=DqzIK80d6ihVj9p2qBPJwBjM0V3kl6MRRjKowVB61Ak,8
|
11
|
+
puantum/quantum/dsa/__init__.py,sha256=r9eRKYMhU7KC2nwb1hW26KVpwz2XuXDQBzW3m36yCkM,127
|
12
|
+
puantum/quantum/dsa/__init__.pyi,sha256=r9eRKYMhU7KC2nwb1hW26KVpwz2XuXDQBzW3m36yCkM,127
|
13
|
+
puantum/quantum/dsa/__internal__.py,sha256=HWON0ta7EV09NXbXSh7rNKbUsTdeg9Wf5-oQcRan7Eo,19533
|
14
|
+
puantum/quantum/dsa/__internal__.pyi,sha256=4jcZLPVF708R1ru6xxEv_AjocJoQOlyAQUCICXSnyNo,8782
|
15
|
+
puantum/quantum/kem/__init__.py,sha256=U3TwWZ7eIYQgPeMXN2pfQvaqdWQimQTP-KDosfFvwk0,127
|
16
|
+
puantum/quantum/kem/__init__.pyi,sha256=U3TwWZ7eIYQgPeMXN2pfQvaqdWQimQTP-KDosfFvwk0,127
|
17
|
+
puantum/quantum/kem/__internal__.py,sha256=es__oqu6tzaRhXx6x8J5twb3CK-9zXCsPmeNRPMAfow,19144
|
18
|
+
puantum/quantum/kem/__internal__.pyi,sha256=RK_Xne8sV6b2EeeZEJ_SW-vi5pnr4staTSrHncmSBio,8434
|
19
|
+
puantum-10.0.0.0.dist-info/RECORD,,
|
puantum-1.2.3.dist-info/RECORD
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
puantum-1.2.3.dist-info/METADATA,sha256=IcjYtA9_vDMTDNE7in_Z_rOi7zO7n-CePcjpZFIgeUs,1524
|
2
|
-
puantum-1.2.3.dist-info/WHEEL,sha256=IPzRd0nigP4r3GK-lmtM2DKCRPiRfyNhNj4tmNbAOTQ,108
|
3
|
-
puantum-1.2.3.dist-info/licenses/license.md,sha256=tQZYOMusRS38hVum5uAxSBrSxoQG9w0h6tkyE3RlPmw,1212
|
4
|
-
puantum/__init__.py,sha256=DqzIK80d6ihVj9p2qBPJwBjM0V3kl6MRRjKowVB61Ak,8
|
5
|
-
puantum/__internal__.cpython-312-x86_64-linux-gnu.so,sha256=vBEtdfLDAmoj98xYKIbEWH_2FDQn-RxlhRadKngIZzI,8279488
|
6
|
-
puantum/classic/__init__.py,sha256=Dlr1m0uJio3HWH8_gkdhnQS87KUZfUw5wX4tXQtbvWQ,35
|
7
|
-
puantum/quantum/__init__.py,sha256=DqzIK80d6ihVj9p2qBPJwBjM0V3kl6MRRjKowVB61Ak,8
|
8
|
-
puantum/quantum/dsa/__init__.py,sha256=r9eRKYMhU7KC2nwb1hW26KVpwz2XuXDQBzW3m36yCkM,127
|
9
|
-
puantum/quantum/dsa/__internal__.py,sha256=HWON0ta7EV09NXbXSh7rNKbUsTdeg9Wf5-oQcRan7Eo,19533
|
10
|
-
puantum/quantum/kem/__init__.py,sha256=U3TwWZ7eIYQgPeMXN2pfQvaqdWQimQTP-KDosfFvwk0,127
|
11
|
-
puantum/quantum/kem/__internal__.py,sha256=es__oqu6tzaRhXx6x8J5twb3CK-9zXCsPmeNRPMAfow,19144
|
12
|
-
puantum-1.2.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|