X-Git-Url: http://www.git.cypherpunks.ru/?p=pygost.git;a=blobdiff_plain;f=pygost%2Ftest_gost34112012.py;fp=pygost%2Ftest_gost34112012.py;h=c7c2df9220e4200200c53ccf8f7d52a175813ca5;hp=fdec31af902c003065167b1460bfe55177f9b9db;hb=63d5c5a81f29bfbb2e6eff3d8dc730a33ef80427;hpb=fffc38fbb9568b83575edeb2d6040fdf39fe7288 diff --git a/pygost/test_gost34112012.py b/pygost/test_gost34112012.py index fdec31a..c7c2df9 100644 --- a/pygost/test_gost34112012.py +++ b/pygost/test_gost34112012.py @@ -14,6 +14,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from os import urandom +from random import randint from unittest import skip from unittest import TestCase import hmac @@ -37,6 +39,20 @@ class TestCopy(TestCase): 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 """