Skip to content

Commit

Permalink
Enforce type hints for idpf.py idpf_poplar.py tests/*idpf*.py
Browse files Browse the repository at this point in the history
  • Loading branch information
cjpatton committed Jun 11, 2024
1 parent 51ed5a1 commit 8e10a1b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
18 changes: 8 additions & 10 deletions poc/idpf.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,33 @@

from __future__ import annotations

from typing import Union

import field
from typing import Any, Union


class Idpf:
"""An Incremental Distributed Point Function (IDPF)."""

# Number of keys generated by the IDPF-key generation algorithm.
SHARES: int = None
SHARES: int

# Bit length of valid input values (i.e., the length of `alpha` in bits).
BITS: int = None
BITS: int

# The length of each output vector (i.e., the length of `beta_leaf` and
# each element of `beta_inner`).
VALUE_LEN: int = None
VALUE_LEN: int

# Size in bytes of each IDPF key share.
KEY_SIZE: int = None
KEY_SIZE: int

# Number of random bytes consumed by the `gen()` algorithm.
RAND_SIZE: int = None
RAND_SIZE: int

# The finite field used to represent the inner nodes of the IDPF tree.
FieldInner: field.Field = None
FieldInner: Any = None

# The finite field used to represent the leaf nodes of the IDPF tree.
FieldLeaf: field.Field = None
FieldLeaf: Any = None

# Type alias for the output of `eval()`.
Output = Union[list[list[FieldInner]],
Expand Down
2 changes: 1 addition & 1 deletion poc/idpf_poplar.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ def decode_public_share(IdpfPoplar, encoded):
return correction_words

@classmethod
def with_bits(cls, bits: int):
def with_bits(cls, bits):
"""
Set `BITS`.
Expand Down

0 comments on commit 8e10a1b

Please sign in to comment.