]> Cypherpunks.ru repositories - pygost.git/blob - pygost/stubs/pygost/gost3410.pyi
Human readable curve name
[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 PublicKey = Tuple[int, int]
8
9
10 class GOST3410Curve(object):
11     p = ...  # type: int
12     q = ...  # type: int
13     a = ...  # type: int
14     b = ...  # type: int
15     x = ...  # type: int
16     y = ...  # type: int
17     cofactor = ...  # type: int
18     e = ...  # type: int
19     d = ...  # type: int
20     name = ...  # type: str
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             name: str = None,
34     ) -> None: ...
35
36     def pos(self, v: int) -> int: ...
37
38     def exp(self, degree: int, x: int = ..., y: int = ...) -> int: ...
39
40     def st(self) -> Tuple[int, int]: ...
41
42     @property
43     def point_size(self) -> int: ...
44
45     def contains(self, point: Tuple[int, int]) -> bool: ...
46
47
48 def public_key(curve: GOST3410Curve, prv: int) -> PublicKey: ...
49
50
51 def sign(curve: GOST3410Curve, prv: int, digest: bytes, rand: bytes = None) -> bytes: ...
52
53
54 def verify(curve: GOST3410Curve, pub: PublicKey, digest: bytes, signature: bytes) -> bool: ...
55
56
57 def prv_unmarshal(prv: bytes) -> int: ...
58
59
60 def prv_marshal(curve: GOST3410Curve, prv: int) -> bytes: ...
61
62
63 def pub_marshal(pub: PublicKey) -> bytes: ...
64
65
66 def pub_unmarshal(pub: bytes) -> PublicKey: ...
67
68
69 def uv2xy(curve: GOST3410Curve, u: int, v: int) -> Tuple[int, int]: ...
70
71
72 def xy2uv(curve: GOST3410Curve, x: int, y: int) -> Tuple[int, int]: ...