]> Cypherpunks.ru repositories - pygost.git/blob - pygost/stubs/pygost/gost3410.pyi
Coordinates conversion from/to twisted Edwards to Weierstass form
[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(curve: GOST3410Curve, prv: int, digest: bytes, mode: int=...) -> bytes: ...
44
45
46 def verify(
47     curve: GOST3410Curve,
48     pub: PublicKey,
49     digest: bytes,
50     signature: bytes,
51     mode: int=...,
52 ) -> bool: ...
53
54
55 def prv_unmarshal(prv: bytes) -> int: ...
56
57
58 def pub_marshal(pub: PublicKey, mode: int=...) -> bytes: ...
59
60
61 def pub_unmarshal(pub: bytes, mode: int=...) -> PublicKey: ...
62
63
64 def uv2xy(curve: GOST3410Curve, u: int, v: int) -> Tuple[int, int]: ...
65
66
67 def xy2uv(curve: GOST3410Curve, x: int, y: int) -> Tuple[int, int]: ...