]> Cypherpunks.ru repositories - pygost.git/blob - pygost/stubs/pygost/gost3410.pyi
afab2659e665c19d430c88b6869674f5f2e8a97c
[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     e = ...  # type: int
19     d = ...  # type: int
20
21     def __init__(
22             self,
23             p: int,
24             q: int,
25             a: int,
26             b: int,
27             x: int,
28             y: int,
29             e: int = None,
30             d: int = None,
31     ) -> None: ...
32
33     def pos(self, v: int) -> int: ...
34
35     def exp(self, degree: int, x: int=..., y: int=...) -> int: ...
36
37     def st(self) -> Tuple[int, int]: ...
38
39
40 def public_key(curve: GOST3410Curve, prv: int) -> PublicKey: ...
41
42
43 def sign(
44         curve: GOST3410Curve,
45         prv: int,
46         digest: bytes,
47         rand: bytes=None,
48         mode: int=...,
49 ) -> bytes: ...
50
51
52 def verify(
53     curve: GOST3410Curve,
54     pub: PublicKey,
55     digest: bytes,
56     signature: bytes,
57     mode: int=...,
58 ) -> bool: ...
59
60
61 def prv_unmarshal(prv: bytes) -> int: ...
62
63
64 def pub_marshal(pub: PublicKey, mode: int=...) -> bytes: ...
65
66
67 def pub_unmarshal(pub: bytes, mode: int=...) -> PublicKey: ...
68
69
70 def uv2xy(curve: GOST3410Curve, u: int, v: int) -> Tuple[int, int]: ...
71
72
73 def xy2uv(curve: GOST3410Curve, x: int, y: int) -> Tuple[int, int]: ...