X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=pygost%2Futils.py;h=0ec91fc56fe980639b88e91743d582f14759750b;hb=d59175f7b4ae74bf32dee438fb64577140e0ac23;hp=1fdba000f842517d7e40869aa51577c5841c6fe4;hpb=c5a63fc144c59342e32304e4e86b2bad479a8187;p=pygost.git diff --git a/pygost/utils.py b/pygost/utils.py index 1fdba00..0ec91fc 100644 --- a/pygost/utils.py +++ b/pygost/utils.py @@ -1,11 +1,10 @@ # coding: utf-8 # PyGOST -- Pure Python GOST cryptographic functions library -# Copyright (C) 2015-2016 Sergey Matveev +# Copyright (C) 2015-2020 Sergey Matveev # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. +# the Free Software Foundation, version 3 of the License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -56,7 +55,7 @@ def bytes2long(raw): """ Deserialize big-endian bytes into long number :param bytes raw: binary string - :return: deserialized long number + :returns: deserialized long number :rtype: int """ return int(hexenc(raw), 16) @@ -66,7 +65,7 @@ def long2bytes(n, size=32): """ Serialize long number into big-endian bytestring :param long n: long number - :return: serialized bytestring + :returns: serialized bytestring :rtype: bytes """ res = hex(int(n))[2:].rstrip("L") @@ -81,7 +80,7 @@ def long2bytes(n, size=32): def modinvert(a, n): """ Modular multiplicative inverse - :return: inverse number. -1 if it does not exist + :returns: inverse number. -1 if it does not exist Realization is taken from: https://en.wikipedia.org/wiki/Extended_Euclidean_algorithm