Skip to content

Commit be0d0ac

Browse files
committed
fix comment
1 parent dd5fcba commit be0d0ac

2 files changed

Lines changed: 16 additions & 8 deletions

File tree

src/lean_spec/subspecs/xmss/interface.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def key_gen(
1717
activation_epoch: int, num_active_epochs: int
1818
) -> Tuple[PublicKey, SecretKey]:
1919
"""
20-
Generates a new cryptographic key pair.
20+
Generates a new cryptographic key pair. This is a **randomized** algorithm.
2121
2222
This function is a placeholder. In a real implementation, it would involve
2323
generating a master secret, deriving all one-time keys, and constructing
@@ -41,7 +41,8 @@ def key_gen(
4141

4242
def sign(sk: SecretKey, epoch: int, message: bytes) -> Signature:
4343
"""
44-
Produces a digital signature for a given message at a specific epoch.
44+
Produces a digital signature for a given message at a specific epoch. This
45+
is a **randomized** algorithm.
4546
4647
This function is a placeholder. The signing process involves encoding the
4748
message, generating a one-time signature, and providing a Merkle path.
@@ -62,7 +63,8 @@ def sign(sk: SecretKey, epoch: int, message: bytes) -> Signature:
6263

6364
def verify(pk: PublicKey, epoch: int, message: bytes, sig: Signature) -> bool:
6465
r"""
65-
Verifies a digital signature against a public key, message, and epoch.
66+
Verifies a digital signature against a public key, message, and epoch. This
67+
is a **deterministic** algorithm.
6668
6769
This function is a placeholder. The complete verification logic is detailed
6870
below and will be implemented in a future update.

src/lean_spec/subspecs/xmss/structures.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,29 @@
11
"""Defines the data structures for the Generalized XMSS signature scheme."""
22

3-
from typing import List
3+
from typing import Annotated, List
44

55
from pydantic import BaseModel, ConfigDict, Field
66

77
from ..koalabear import Fp
88
from .constants import HASH_LEN_FE, PARAMETER_LEN, RAND_LEN_FE
99

10-
HashDigest = List[Fp]
10+
HashDigest = Annotated[
11+
List[Fp], Field(min_length=HASH_LEN_FE, max_length=HASH_LEN_FE)
12+
]
1113
"""
1214
A type alias representing a hash digest.
1315
"""
1416

15-
Parameter = List[Fp]
17+
Parameter = Annotated[
18+
List[Fp], Field(min_length=PARAMETER_LEN, max_length=PARAMETER_LEN)
19+
]
1620
"""
1721
A type alias representing the public parameter `P`.
1822
"""
1923

20-
Randomness = List[Fp]
24+
Randomness = Annotated[
25+
List[Fp], Field(min_length=RAND_LEN_FE, max_length=RAND_LEN_FE)
26+
]
2127
"""
2228
A type alias representing the randomness `rho`.
2329
"""
@@ -55,7 +61,7 @@ class Signature(BaseModel):
5561
rho: Randomness = Field(
5662
..., max_length=RAND_LEN_FE, min_length=RAND_LEN_FE
5763
)
58-
hashes: List[List[Fp]]
64+
hashes: List[HashDigest]
5965

6066

6167
class SecretKey(BaseModel):

0 commit comments

Comments
 (0)