: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]
def prv_unmarshal(prv):
- """Unmarshal private key
+ """Unmarshal little-endian private key
:param bytes prv: serialized private key
:rtype: long
:type pub: (long, long)
:rtype: bytes
+ :returns: LE(X) || LE(Y)
"""
size = MODE2SIZE[mode]
return (long2bytes(pub[1], size) + long2bytes(pub[0], size))[::-1]
def pub_unmarshal(pub, mode=2001):
"""Unmarshal public key
+ :param pub: LE(X) || LE(Y)
:type pub: bytes
:rtype: (long, long)
"""
def ukm_unmarshal(ukm):
"""Unmarshal UKM value
- :type ukm: bytes
+ :type ukm: little-endian bytes
:rtype: long
"""
return bytes2long(ukm[::-1])
"""
return GOST341194(
kek(curve, prv, pub, ukm, mode=2001),
- "id-GostR3411-94-CryptoProParamSet",
+ sbox="id-GostR3411-94-CryptoProParamSet",
).digest()