@table @strong
+@anchor{Release 5.12}
+@item 5.12
+Fixed incorrect digest calculation when using @code{GOST34112012*.update()}
+method.
+
@anchor{Release 5.11}
@item 5.11
@code{gost34112012}'s @code{update()}/@code{digest()} methods are
PyGOST is free software: see the file COPYING for copying conditions.
"""
-__version__ = "5.11"
+__version__ = "5.12"
the twisted Edwards form
:param str name: human-readable curve name
"""
+
def __init__(self, p, q, a, b, x, y, cofactor=1, e=None, d=None, name=None):
self.p = p
self.q = q
"""Update state with the new data
"""
if len(self.buf) > 0:
- self.buf += data[:BLOCKSIZE - len(self.buf)]
- data = data[BLOCKSIZE - len(self.buf):]
+ chunk_len = BLOCKSIZE - len(self.buf)
+ self.buf += data[:chunk_len]
+ data = data[chunk_len:]
if len(self.buf) == BLOCKSIZE:
self._update_block(self.buf)
self.buf = b""
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+from os import urandom
+from random import randint
from unittest import skip
from unittest import TestCase
import hmac
self.assertSequenceEqual(m.digest(), c.digest())
+class TestSymmetric(TestCase):
+ def runTest(self):
+ chunks = []
+ for _ in range(randint(1, 10)):
+ chunks.append(urandom(randint(20, 80)))
+ m = GOST34112012256()
+ for chunk in chunks:
+ m.update(chunk)
+ self.assertSequenceEqual(
+ m.hexdigest(),
+ GOST34112012256(b"".join(chunks)).hexdigest(),
+ )
+
+
class TestHMAC(TestCase):
"""RFC 7836
"""