Skip to content

Commit a0dac69

Browse files
authored
Merge pull request #87 from tomato42/stable-api
mark the ML-KEM API as stable
2 parents b187189 + 6504ce4 commit a0dac69

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ use:
8989
- `ML_KEM.encaps(ek)`: generate a key and ciphertext pair `(key, ct)`
9090
- `ML_KEM.decaps(dk, ct)`: generate the shared key `key`
9191

92+
Those, together with the `ML_KEM_512`, `ML_KEM_768`, and `ML_KEM_1024`
93+
objects comprise the kyber-py library stable API.
94+
9295
#### Example
9396

9497
```python

src/kyber_py/ml_kem/default_parameters.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,24 @@
2222
Key exchange object that uses ML-KEM-512 parameters internally.
2323
2424
Provides about 128 bit level of security.
25+
26+
Part of stable API.
2527
"""
2628

2729
ML_KEM_768 = ML_KEM(DEFAULT_PARAMETERS["ML768"])
2830
"""
2931
Key exchange object that uses ML-KEM-768 parameters internally.
3032
3133
Provides about 192 bit level of security.
34+
35+
Part of stable API.
3236
"""
3337

3438
ML_KEM_1024 = ML_KEM(DEFAULT_PARAMETERS["ML1024"])
3539
"""
3640
Key exchange object that uses ML-KEM-1024 parameters internally.
3741
3842
Provides about 256 bit level of security.
43+
44+
Part of stable API.
3945
"""

src/kyber_py/ml_kem/ml_kem.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,8 @@ def keygen(self):
279279
``ek`` is encoded as bytes of length 384*k + 32
280280
``dk`` is encoded as bytes of length 768*k + 96
281281
282+
Part of stable API.
283+
282284
:return: Tuple with encapsulation key and decapsulation key.
283285
:rtype: tuple(bytes, bytes)
284286
"""
@@ -324,8 +326,10 @@ def encaps(self, ek):
324326
``K`` is the shared secret key of length 32 bytes
325327
``c`` is the ciphertext of length 32(du*k + dv)
326328
329+
Part of stable API.
330+
327331
:param bytes ek: byte-encoded encapsulation key
328-
:return: a random key and an encapsulation of it
332+
:return: a random key (``K``) and an encapsulation of it (``c``)
329333
:rtype: tuple(bytes, bytes)
330334
"""
331335
# Create random tokens
@@ -395,9 +399,11 @@ def decaps(self, dk, c):
395399
396400
``K`` is the shared secret key of length 32 bytes
397401
402+
Part of stable API.
403+
398404
:param bytes dk: decapsulation key
399405
:param bytes c: ciphertext with an encapsulated key
400-
:return: shared secret key
406+
:return: shared secret key (``K``)
401407
:rtype: bytes
402408
"""
403409
try:

0 commit comments

Comments
 (0)