]> Cypherpunks.ru repositories - pygost.git/blob - pygost/stubs/pygost/gost3410.pyi
Use curve's cofactor during VKO calculations
[pygost.git] / pygost / stubs / pygost / gost3410.pyi
1 from typing import Dict
2 from typing import Tuple
3
4
5 DEFAULT_CURVE = ...  # type: GOST3410Curve
6 CURVES = ...  # type: Dict[str, GOST3410Curve]
7 MODE2SIZE = ...  # type: Dict[int, int]
8 PublicKey = Tuple[int, int]
9
10
11 class GOST3410Curve(object):
12     p = ...  # type: int
13     q = ...  # type: int
14     a = ...  # type: int
15     b = ...  # type: int
16     x = ...  # type: int
17     y = ...  # type: int
18     cofactor = ...  # type: int
19     e = ...  # type: int
20     d = ...  # type: int
21
22     def __init__(
23             self,
24             p: int,
25             q: int,
26             a: int,
27             b: int,
28             x: int,
29             y: int,
30             cofactor: int = 1,
31             e: int = None,
32             d: int = None,
33     ) -> None: ...
34
35     def pos(self, v: int) -> int: ...
36
37     def exp(self, degree: int, x: int=..., y: int=...) -> int: ...
38
39     def st(self) -> Tuple[int, int]: ...
40
41
42 def public_key(curve: GOST3410Curve, prv: int) -> PublicKey: ...
43
44
45 def sign(
46         curve: GOST3410Curve,
47         prv: int,
48         digest: bytes,
49         rand: bytes=None,
50         mode: int=...,
51 ) -> bytes: ...
52
53
54 def verify(
55     curve: GOST3410Curve,
56     pub: PublicKey,
57     digest: bytes,
58     signature: bytes,
59     mode: int=...,
60 ) -> bool: ...
61
62
63 def prv_unmarshal(prv: bytes) -> int: ...
64
65
66 def pub_marshal(pub: PublicKey, mode: int=...) -> bytes: ...
67
68
69 def pub_unmarshal(pub: bytes, mode: int=...) -> PublicKey: ...
70
71
72 def uv2xy(curve: GOST3410Curve, u: int, v: int) -> Tuple[int, int]: ...
73
74
75 def xy2uv(curve: GOST3410Curve, x: int, y: int) -> Tuple[int, int]: ...