puantum 1.2.3__tar.gz → 3.3.3__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.
- puantum-3.3.3/.github/workflows/publish.yml +36 -0
- {puantum-1.2.3 → puantum-3.3.3}/Makefile +13 -13
- {puantum-1.2.3 → puantum-3.3.3}/PKG-INFO +40 -6
- puantum-3.3.3/puantum/classic/__init__.pyi +1 -0
- puantum-3.3.3/puantum/quantum/__init__.py +1 -0
- puantum-3.3.3/puantum/quantum/__init__.pyi +1 -0
- puantum-3.3.3/puantum/quantum/dsa/__init__.pyi +5 -0
- puantum-3.3.3/puantum/quantum/dsa/__internal__.pyi +388 -0
- puantum-3.3.3/puantum/quantum/kem/__init__.pyi +5 -0
- puantum-3.3.3/puantum/quantum/kem/__internal__.pyi +363 -0
- {puantum-1.2.3 → puantum-3.3.3}/pyproject.toml +1 -1
- puantum-3.3.3/readme.md +82 -0
- puantum-1.2.3/README.md +0 -48
- puantum-1.2.3/examples/dsa.py +0 -14
- puantum-1.2.3/examples/kem.py +0 -14
- puantum-1.2.3/readme.md +0 -48
- {puantum-1.2.3 → puantum-3.3.3}/.gitignore +0 -0
- {puantum-1.2.3 → puantum-3.3.3}/Cargo.lock +0 -0
- {puantum-1.2.3 → puantum-3.3.3}/Cargo.toml +0 -0
- {puantum-1.2.3 → puantum-3.3.3}/license.md +0 -0
- {puantum-1.2.3 → puantum-3.3.3}/puantum/__init__.py +0 -0
- /puantum-1.2.3/puantum/quantum/__init__.py → /puantum-3.3.3/puantum/__init__.pyi +0 -0
- {puantum-1.2.3 → puantum-3.3.3}/puantum/classic/__init__.py +0 -0
- {puantum-1.2.3 → puantum-3.3.3}/puantum/quantum/dsa/__init__.py +0 -0
- {puantum-1.2.3 → puantum-3.3.3}/puantum/quantum/dsa/__internal__.py +0 -0
- {puantum-1.2.3 → puantum-3.3.3}/puantum/quantum/kem/__init__.py +0 -0
- {puantum-1.2.3 → puantum-3.3.3}/puantum/quantum/kem/__internal__.py +0 -0
- {puantum-1.2.3 → puantum-3.3.3}/rust/cryptography/classic/mod.rs +0 -0
- {puantum-1.2.3 → puantum-3.3.3}/rust/cryptography/mod.rs +0 -0
- {puantum-1.2.3 → puantum-3.3.3}/rust/cryptography/quantum/binding.rs +0 -0
- {puantum-1.2.3 → puantum-3.3.3}/rust/cryptography/quantum/mod.rs +0 -0
- {puantum-1.2.3 → puantum-3.3.3}/rust/python.rs +0 -0
@@ -0,0 +1,36 @@
|
|
1
|
+
name: Build and Publish to PyPI
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- main # Trigger on every push to the main branch
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
build-and-publish:
|
10
|
+
runs-on: ubuntu-latest
|
11
|
+
|
12
|
+
steps:
|
13
|
+
- name: Checkout repository
|
14
|
+
uses: actions/checkout@v4
|
15
|
+
|
16
|
+
- name: Set up Python
|
17
|
+
uses: actions/setup-python@v5
|
18
|
+
with:
|
19
|
+
python-version: '3.13' # Adjust if needed
|
20
|
+
|
21
|
+
- name: Install Rust
|
22
|
+
uses: dtolnay/rust-toolchain@stable
|
23
|
+
|
24
|
+
- name: Install maturin
|
25
|
+
run: pip install maturin
|
26
|
+
|
27
|
+
- name: Build the wheel and sdist
|
28
|
+
run: maturin build --sdist --release
|
29
|
+
|
30
|
+
- name: Publish to PyPI
|
31
|
+
env:
|
32
|
+
TWINE_USERNAME: __token__
|
33
|
+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
|
34
|
+
run: |
|
35
|
+
pip install twine
|
36
|
+
twine upload target/wheels/*
|
@@ -1,13 +1,13 @@
|
|
1
|
-
all: release
|
2
|
-
|
3
|
-
clean:
|
4
|
-
cargo clean
|
5
|
-
|
6
|
-
release: clean
|
7
|
-
cargo build --release
|
8
|
-
|
9
|
-
python: clean
|
10
|
-
maturin build --release
|
11
|
-
|
12
|
-
pypi: clean
|
13
|
-
maturin build --release --sdist
|
1
|
+
all: release
|
2
|
+
|
3
|
+
clean:
|
4
|
+
cargo clean
|
5
|
+
|
6
|
+
release: clean
|
7
|
+
cargo build --release
|
8
|
+
|
9
|
+
python: clean
|
10
|
+
maturin build --release
|
11
|
+
|
12
|
+
pypi: clean
|
13
|
+
maturin build --release --sdist
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: puantum
|
3
|
-
Version:
|
3
|
+
Version: 3.3.3
|
4
4
|
Classifier: Programming Language :: Python :: 3
|
5
5
|
Classifier: Programming Language :: Rust
|
6
6
|
Classifier: Operating System :: OS Independent
|
@@ -19,7 +19,7 @@ Project-URL: x, https://x.com/1xfakebit
|
|
19
19
|
|
20
20
|
A blazing-fast cryptography library for Python, built on Rust.
|
21
21
|
|
22
|
-
|
22
|
+
Pryptography supports an extensive set of **post-quantum** digital signature algorithms (DSA) and key encapsulation mechanisms (KEM).
|
23
23
|
|
24
24
|
---
|
25
25
|
## ⚡ Features
|
@@ -48,15 +48,49 @@ Puantum supports an extensive set of **post-quantum** key encapsulation mechanis
|
|
48
48
|
- #### Sphincs
|
49
49
|
- #### Uov
|
50
50
|
|
51
|
-
###
|
52
|
-
|
53
|
-
|
54
|
-
|
51
|
+
### ❔ Examples
|
52
|
+
|
53
|
+
#### DSA Example
|
54
|
+
```python
|
55
|
+
# IMPORT
|
56
|
+
from puantum.quantum.dsa import Algorithm, KeyPair
|
57
|
+
|
58
|
+
# MAIN
|
59
|
+
alicesk, alicepk = KeyPair(Algorithm.MLDSA.MLDSA87)
|
60
|
+
message = "Hello".encode()
|
61
|
+
|
62
|
+
signature = alicesk.sign(message=message)
|
63
|
+
valid = alicepk.verify(signature=signature, message=message)
|
64
|
+
|
65
|
+
assert valid, "Signature verification failed!"
|
66
|
+
|
67
|
+
print(f"Message: [{message.decode()}]")
|
68
|
+
print(f"Signature: [{signature.hex()[:len(message)]}]")
|
69
|
+
```
|
70
|
+
|
71
|
+
#### KEM Example
|
72
|
+
```python
|
73
|
+
# IMPORT
|
74
|
+
from puantum.quantum.kem import Algorithm, KeyPair
|
75
|
+
|
76
|
+
# MAIN
|
77
|
+
alicesk, alicepk = KeyPair(Algorithm.MLKEM.MLKEM1024)
|
78
|
+
_bobsk, _bobpk = KeyPair(Algorithm.MLKEM.MLKEM1024)
|
79
|
+
|
80
|
+
bobss, bobct = alicepk.encapsulate()
|
81
|
+
alicess = alicesk.decapsulate(bobct)
|
82
|
+
|
83
|
+
assert alicess == bobss, "Shared secrets do not match!"
|
84
|
+
|
85
|
+
print(f"Alice's Shared Secret: [{alicess.hex()}]")
|
86
|
+
print(f"Bob's Shared Secret: [{bobss.hex()}]")
|
87
|
+
```
|
55
88
|
|
56
89
|
### 📦 Install
|
57
90
|
```shell
|
58
91
|
pip install puantum
|
59
92
|
```
|
93
|
+
|
60
94
|
#### or from source:
|
61
95
|
```shell
|
62
96
|
make python
|
@@ -0,0 +1 @@
|
|
1
|
+
# EMPTY
|
@@ -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
|
+
...
|
puantum-3.3.3/readme.md
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
# 🔐 Python Cryptography
|
2
|
+
|
3
|
+
A blazing-fast cryptography library for Python, built on Rust.
|
4
|
+
|
5
|
+
Pryptography supports an extensive set of **post-quantum** digital signature algorithms (DSA) and key encapsulation mechanisms (KEM).
|
6
|
+
|
7
|
+
---
|
8
|
+
## ⚡ Features
|
9
|
+
- ✅ Dozens of NIST PQC candidates
|
10
|
+
- 🦀 Rust core for speed and safety
|
11
|
+
- 📦 Easy installation via [`pip`](https://pip.pypa.io)
|
12
|
+
---
|
13
|
+
|
14
|
+
### 🧬 Supported Algorithms
|
15
|
+
|
16
|
+
### 🛡️ KEM
|
17
|
+
- #### Bike
|
18
|
+
- #### ClassicMcEliece
|
19
|
+
- #### Hqc
|
20
|
+
- #### Kyber
|
21
|
+
- #### MLKEM
|
22
|
+
- #### NtruPrime
|
23
|
+
- #### FrodoKem
|
24
|
+
|
25
|
+
### ✍️ DSA
|
26
|
+
- #### Cross
|
27
|
+
- #### Dilithium
|
28
|
+
- #### Falcon
|
29
|
+
- #### Mayo
|
30
|
+
- #### MLDSA
|
31
|
+
- #### Sphincs
|
32
|
+
- #### Uov
|
33
|
+
|
34
|
+
### ❔ Examples
|
35
|
+
|
36
|
+
#### DSA Example
|
37
|
+
```python
|
38
|
+
# IMPORT
|
39
|
+
from puantum.quantum.dsa import Algorithm, KeyPair
|
40
|
+
|
41
|
+
# MAIN
|
42
|
+
alicesk, alicepk = KeyPair(Algorithm.MLDSA.MLDSA87)
|
43
|
+
message = "Hello".encode()
|
44
|
+
|
45
|
+
signature = alicesk.sign(message=message)
|
46
|
+
valid = alicepk.verify(signature=signature, message=message)
|
47
|
+
|
48
|
+
assert valid, "Signature verification failed!"
|
49
|
+
|
50
|
+
print(f"Message: [{message.decode()}]")
|
51
|
+
print(f"Signature: [{signature.hex()[:len(message)]}]")
|
52
|
+
```
|
53
|
+
|
54
|
+
#### KEM Example
|
55
|
+
```python
|
56
|
+
# IMPORT
|
57
|
+
from puantum.quantum.kem import Algorithm, KeyPair
|
58
|
+
|
59
|
+
# MAIN
|
60
|
+
alicesk, alicepk = KeyPair(Algorithm.MLKEM.MLKEM1024)
|
61
|
+
_bobsk, _bobpk = KeyPair(Algorithm.MLKEM.MLKEM1024)
|
62
|
+
|
63
|
+
bobss, bobct = alicepk.encapsulate()
|
64
|
+
alicess = alicesk.decapsulate(bobct)
|
65
|
+
|
66
|
+
assert alicess == bobss, "Shared secrets do not match!"
|
67
|
+
|
68
|
+
print(f"Alice's Shared Secret: [{alicess.hex()}]")
|
69
|
+
print(f"Bob's Shared Secret: [{bobss.hex()}]")
|
70
|
+
```
|
71
|
+
|
72
|
+
### 📦 Install
|
73
|
+
```shell
|
74
|
+
pip install puantum
|
75
|
+
```
|
76
|
+
|
77
|
+
#### or from source:
|
78
|
+
```shell
|
79
|
+
make python
|
80
|
+
```
|
81
|
+
|
82
|
+
### 🥳 Enjoy!
|
puantum-1.2.3/README.md
DELETED
@@ -1,48 +0,0 @@
|
|
1
|
-
# 🔐 Python Cryptography
|
2
|
-
|
3
|
-
A blazing-fast cryptography library for Python, built on Rust.
|
4
|
-
|
5
|
-
Puantum supports an extensive set of **post-quantum** key encapsulation mechanisms (KEM) and digital signature algorithms (DSA), and will soon support **classic cryptography** as well.
|
6
|
-
|
7
|
-
---
|
8
|
-
## ⚡ Features
|
9
|
-
- ✅ Dozens of NIST PQC candidates
|
10
|
-
- 🦀 Rust core for speed and safety
|
11
|
-
- 📦 Easy installation via [`pip`](https://pip.pypa.io)
|
12
|
-
---
|
13
|
-
|
14
|
-
### 🧬 Supported Algorithms
|
15
|
-
|
16
|
-
### 🛡️ KEM
|
17
|
-
- #### Bike
|
18
|
-
- #### ClassicMcEliece
|
19
|
-
- #### Hqc
|
20
|
-
- #### Kyber
|
21
|
-
- #### MLKEM
|
22
|
-
- #### NtruPrime
|
23
|
-
- #### FrodoKem
|
24
|
-
|
25
|
-
### ✍️ DSA
|
26
|
-
- #### Cross
|
27
|
-
- #### Dilithium
|
28
|
-
- #### Falcon
|
29
|
-
- #### Mayo
|
30
|
-
- #### MLDSA
|
31
|
-
- #### Sphincs
|
32
|
-
- #### Uov
|
33
|
-
|
34
|
-
### 🚧 Coming Soon
|
35
|
-
- #### AES, ChaCha20, XChaCha20
|
36
|
-
- #### RSA, EC
|
37
|
-
- #### Argon2, Bcrypt
|
38
|
-
|
39
|
-
### 📦 Install
|
40
|
-
```shell
|
41
|
-
pip install puantum
|
42
|
-
```
|
43
|
-
#### or from source:
|
44
|
-
```shell
|
45
|
-
make python
|
46
|
-
```
|
47
|
-
|
48
|
-
### 🥳 Enjoy!
|
puantum-1.2.3/examples/dsa.py
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
# IMPORT
|
2
|
-
from puantum.quantum.dsa import Algorithm, KeyPair
|
3
|
-
|
4
|
-
# MAIN
|
5
|
-
alicesk, alicepk = KeyPair(Algorithm.MLDSA.MLDSA87)
|
6
|
-
message = "Hello".encode()
|
7
|
-
|
8
|
-
signature = alicesk.sign(message=message)
|
9
|
-
valid = alicepk.verify(signature=signature, message=message)
|
10
|
-
|
11
|
-
assert valid, "Signature verification failed!"
|
12
|
-
|
13
|
-
print(f"Message: [{message.decode()}]")
|
14
|
-
print(f"Signature: [{signature.hex()[:len(message)]}]")
|
puantum-1.2.3/examples/kem.py
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
# IMPORT
|
2
|
-
from puantum.quantum.kem import Algorithm, KeyPair
|
3
|
-
|
4
|
-
# MAIN
|
5
|
-
alicesk, alicepk = KeyPair(Algorithm.MLKEM.MLKEM1024)
|
6
|
-
_bobsk, _bobpk = KeyPair(Algorithm.MLKEM.MLKEM1024)
|
7
|
-
|
8
|
-
bobss, bobct = alicepk.encapsulate()
|
9
|
-
alicess = alicesk.decapsulate(bobct)
|
10
|
-
|
11
|
-
assert alicess == bobss, "Shared secrets do not match!"
|
12
|
-
|
13
|
-
print(f"Alice's Shared Secret: [{alicess.hex()}]")
|
14
|
-
print(f"Bob's Shared Secret: [{bobss.hex()}]")
|
puantum-1.2.3/readme.md
DELETED
@@ -1,48 +0,0 @@
|
|
1
|
-
# 🔐 Python Cryptography
|
2
|
-
|
3
|
-
A blazing-fast cryptography library for Python, built on Rust.
|
4
|
-
|
5
|
-
Puantum supports an extensive set of **post-quantum** key encapsulation mechanisms (KEM) and digital signature algorithms (DSA), and will soon support **classic cryptography** as well.
|
6
|
-
|
7
|
-
---
|
8
|
-
## ⚡ Features
|
9
|
-
- ✅ Dozens of NIST PQC candidates
|
10
|
-
- 🦀 Rust core for speed and safety
|
11
|
-
- 📦 Easy installation via [`pip`](https://pip.pypa.io)
|
12
|
-
---
|
13
|
-
|
14
|
-
### 🧬 Supported Algorithms
|
15
|
-
|
16
|
-
### 🛡️ KEM
|
17
|
-
- #### Bike
|
18
|
-
- #### ClassicMcEliece
|
19
|
-
- #### Hqc
|
20
|
-
- #### Kyber
|
21
|
-
- #### MLKEM
|
22
|
-
- #### NtruPrime
|
23
|
-
- #### FrodoKem
|
24
|
-
|
25
|
-
### ✍️ DSA
|
26
|
-
- #### Cross
|
27
|
-
- #### Dilithium
|
28
|
-
- #### Falcon
|
29
|
-
- #### Mayo
|
30
|
-
- #### MLDSA
|
31
|
-
- #### Sphincs
|
32
|
-
- #### Uov
|
33
|
-
|
34
|
-
### 🚧 Coming Soon
|
35
|
-
- #### AES, ChaCha20, XChaCha20
|
36
|
-
- #### RSA, EC
|
37
|
-
- #### Argon2, Bcrypt
|
38
|
-
|
39
|
-
### 📦 Install
|
40
|
-
```shell
|
41
|
-
pip install puantum
|
42
|
-
```
|
43
|
-
#### or from source:
|
44
|
-
```shell
|
45
|
-
make python
|
46
|
-
```
|
47
|
-
|
48
|
-
### 🥳 Enjoy!
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|