summaryrefslogtreecommitdiff
path: root/pygost
diff options
context:
space:
mode:
authorSergey Matveev <stargrave@stargrave.org>2020-07-02 11:22:26 +0300
committerSergey Matveev <stargrave@stargrave.org>2020-07-02 11:22:26 +0300
commitc36d50a5003f360ff22f93e286efd0f614523427 (patch)
tree2ce115dd51d12f9db57c1c9618ddb7313a8a0553 /pygost
parente80e420f30a83e53702dc31abb640be0e06e6143 (diff)
downloadpygost-master.tar.xz
Explicit mention of 34.10-related endiannessHEADmaster
Diffstat (limited to 'pygost')
-rw-r--r--pygost/gost3410.py6
-rw-r--r--pygost/gost3410_vko.py4
2 files changed, 6 insertions, 4 deletions
diff --git a/pygost/gost3410.py b/pygost/gost3410.py
index 7e92e34..d7c733d 100644
--- a/pygost/gost3410.py
+++ b/pygost/gost3410.py
@@ -231,7 +231,7 @@ def sign(curve, prv, digest, rand=None, mode=2001):
:type digest: bytes, 32 or 64 bytes
:param rand: optional predefined random data used for k/r generation
:type rand: bytes, 32 or 64 bytes
- :returns: signature
+ :returns: signature, BE(S) || BE(R)
:rtype: bytes, 64 or 128 bytes
"""
size = MODE2SIZE[mode]
@@ -305,7 +305,7 @@ def verify(curve, pub, digest, signature, mode=2001):
def prv_unmarshal(prv):
- """Unmarshal private key
+ """Unmarshal little-endian private key
:param bytes prv: serialized private key
:rtype: long
@@ -318,6 +318,7 @@ def pub_marshal(pub, mode=2001):
:type pub: (long, long)
:rtype: bytes
+ :returns: LE(X) || LE(Y)
"""
size = MODE2SIZE[mode]
return (long2bytes(pub[1], size) + long2bytes(pub[0], size))[::-1]
@@ -326,6 +327,7 @@ def pub_marshal(pub, mode=2001):
def pub_unmarshal(pub, mode=2001):
"""Unmarshal public key
+ :param pub: LE(X) || LE(Y)
:type pub: bytes
:rtype: (long, long)
"""
diff --git a/pygost/gost3410_vko.py b/pygost/gost3410_vko.py
index 046df9e..6ffc953 100644
--- a/pygost/gost3410_vko.py
+++ b/pygost/gost3410_vko.py
@@ -26,7 +26,7 @@ from pygost.utils import bytes2long
def ukm_unmarshal(ukm):
"""Unmarshal UKM value
- :type ukm: bytes
+ :type ukm: little-endian bytes
:rtype: long
"""
return bytes2long(ukm[::-1])
@@ -55,7 +55,7 @@ def kek_34102001(curve, prv, pub, ukm):
"""
return GOST341194(
kek(curve, prv, pub, ukm, mode=2001),
- "id-GostR3411-94-CryptoProParamSet",
+ sbox="id-GostR3411-94-CryptoProParamSet",
).digest()