NEWS | 3 +++ VERSION | 2 +- pygost/gost3412.py | 2 +- pygost/stubs/pygost/gost3412.pyi | 2 +- pygost/test_gost3412.py | 8 ++++---- pygost/test_gost3413.py | 18 +++++++++--------- www.texi | 5 +++++ diff --git a/NEWS b/NEWS index 140a0b3e3a8c745b6793c6f2ddad9e6c0454c2425d233da5e12809576cec0cb3..9500692d0746e5707b28c33c21d614d4fb45549862a127a7d0ac56566e5587c9 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,6 @@ +3.3: + * GOST3412Kuz renamed to GOST3412Kuznezhik + 3.2: 34.13-2015 block cipher modes of operation implementations. diff --git a/VERSION b/VERSION index c0431d09ec2f32c68d8ee7484cb0f15fd20f59d2bd7d7ec5cbb204f3b373287f..11e557ac2f7fa212b331b212b052bff9cae420ab4df0579c844624dd2e86bce1 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.2 +3.3 diff --git a/pygost/gost3412.py b/pygost/gost3412.py index ac9dd48ded6a860937b65baf631ccf212e72280a18d0dd0a74742ee29d09e5ce..6a5d5681bc195bf6fbe4af85124f0f51c5d3d4d43debf45062484f8a719465b4 100644 --- a/pygost/gost3412.py +++ b/pygost/gost3412.py @@ -121,7 +121,7 @@ def lp(blk): return L([PI[v] for v in blk]) -class GOST3412Kuz(object): +class GOST3412Kuznechik(object): """GOST 34.12-2015 128-bit block cipher Кузнечик (Kuznechik) """ def __init__(self, key): diff --git a/pygost/stubs/pygost/gost3412.pyi b/pygost/stubs/pygost/gost3412.pyi index ab79032901fcdd1512de6746ce8e53d173e569e8c85f5e495d62f44992128f59..7ca37caccdd9fd228fba29852fa99947b6b6d577fa540cfae0e62b59c21d0d4b 100644 --- a/pygost/stubs/pygost/gost3412.pyi +++ b/pygost/stubs/pygost/gost3412.pyi @@ -1,4 +1,4 @@ -class GOST3412Kuz(object): +class GOST3412Kuznechik(object): def __init__(self, key: bytes) -> None: ... def encrypt(self, blk: bytes) -> bytes: ... diff --git a/pygost/test_gost3412.py b/pygost/test_gost3412.py index be306418d6bdced9900c78223b0413c79409d50da6e3d959e4a77bd72023d6c3..dd2c9d6e3fa0920b709cb75b27033ddbdcc7b0e630dcd2ca1aed0020fefa0dce 100644 --- a/pygost/test_gost3412.py +++ b/pygost/test_gost3412.py @@ -18,7 +18,7 @@ from unittest import TestCase from pygost.gost3412 import C -from pygost.gost3412 import GOST3412Kuz +from pygost.gost3412 import GOST3412Kuznechik from pygost.gost3412 import L from pygost.gost3412 import PI from pygost.utils import hexdec @@ -102,7 +102,7 @@ self.assertEqual(C[6], hexdec("c9e8819dc73ba5ae50f5b570561a6a07")) self.assertEqual(C[7], hexdec("f6593616e6055689adfba18027aa2a08")) def test_roundkeys(self): - ciph = GOST3412Kuz(self.key) + ciph = GOST3412Kuznechik(self.key) self.assertEqual(ciph.ks[0], hexdec("8899aabbccddeeff0011223344556677")) self.assertEqual(ciph.ks[1], hexdec("fedcba98765432100123456789abcdef")) self.assertEqual(ciph.ks[2], hexdec("db31485315694343228d6aef8cc78c44")) @@ -115,9 +115,9 @@ self.assertEqual(ciph.ks[8], hexdec("bb44e25378c73123a5f32f73cdb6e517")) self.assertEqual(ciph.ks[9], hexdec("72e9dd7416bcf45b755dbaa88e4a4043")) def test_encrypt(self): - ciph = GOST3412Kuz(self.key) + ciph = GOST3412Kuznechik(self.key) self.assertEqual(ciph.encrypt(self.plaintext), self.ciphertext) def test_decrypt(self): - ciph = GOST3412Kuz(self.key) + ciph = GOST3412Kuznechik(self.key) self.assertEqual(ciph.decrypt(self.ciphertext), self.plaintext) diff --git a/pygost/test_gost3413.py b/pygost/test_gost3413.py index ce21f943de0b2aa8873811b1a75aeb2214a9c3b2d5c34e5dfc1fd5f4d24703bb..fd2feaec68d891728e83a3a47c4ba6d5247a979eb88f5ee6b8a5673438d77faa 100644 --- a/pygost/test_gost3413.py +++ b/pygost/test_gost3413.py @@ -2,7 +2,7 @@ from os import urandom from random import randint from unittest import TestCase -from pygost.gost3412 import GOST3412Kuz +from pygost.gost3412 import GOST3412Kuznechik from pygost.gost3413 import _mac_ks from pygost.gost3413 import cbc_decrypt from pygost.gost3413 import cbc_encrypt @@ -30,9 +30,9 @@ data, ) -class GOST3412KuzModesTest(TestCase): +class GOST3412KuznechikModesTest(TestCase): key = hexdec("8899aabbccddeeff0011223344556677fedcba98765432100123456789abcdef") - ciph = GOST3412Kuz(key) + ciph = GOST3412Kuznechik(key) plaintext = "" plaintext += "1122334455667700ffeeddccbbaa9988" plaintext += "00112233445566778899aabbcceeff0a" @@ -58,7 +58,7 @@ def test_ecb_symmetric(self): for _ in range(100): pt = pad2(urandom(randint(0, 16 * 2)), 16) - ciph = GOST3412Kuz(urandom(32)) + ciph = GOST3412Kuznechik(urandom(32)) ct = ecb_encrypt(ciph.encrypt, 16, pt) self.assertSequenceEqual(ecb_decrypt(ciph.decrypt, 16, ct), pt) @@ -82,7 +82,7 @@ def test_ctr_symmetric(self): for _ in range(100): pt = urandom(randint(0, 16 * 2)) iv = urandom(8) - ciph = GOST3412Kuz(urandom(32)) + ciph = GOST3412Kuznechik(urandom(32)) ct = ctr(ciph.encrypt, 16, pt, iv) self.assertSequenceEqual(ctr(ciph.encrypt, 16, ct, iv), pt) @@ -105,7 +105,7 @@ def test_ofb_symmetric(self): for _ in range(100): pt = urandom(randint(0, 16 * 2)) iv = urandom(16 * 2) - ciph = GOST3412Kuz(urandom(32)) + ciph = GOST3412Kuznechik(urandom(32)) ct = ofb(ciph.encrypt, 16, pt, iv) self.assertSequenceEqual(ofb(ciph.encrypt, 16, ct, iv), pt) @@ -128,7 +128,7 @@ def test_cbc_symmetric(self): for _ in range(100): pt = pad2(urandom(randint(0, 16 * 2)), 16) iv = urandom(16 * 2) - ciph = GOST3412Kuz(urandom(32)) + ciph = GOST3412Kuznechik(urandom(32)) ct = cbc_encrypt(ciph.encrypt, 16, pt, iv) self.assertSequenceEqual(cbc_decrypt(ciph.decrypt, 16, ct, iv), pt) @@ -151,7 +151,7 @@ def test_cfb_symmetric(self): for _ in range(100): pt = urandom(randint(0, 16 * 2)) iv = urandom(16 * 2) - ciph = GOST3412Kuz(urandom(32)) + ciph = GOST3412Kuznechik(urandom(32)) ct = cfb_encrypt(ciph.encrypt, 16, pt, iv) self.assertSequenceEqual(cfb_decrypt(ciph.encrypt, 16, ct, iv), pt) @@ -167,5 +167,5 @@ def test_mac_applies(self): for _ in range(100): data = urandom(randint(0, 16 * 2)) - ciph = GOST3412Kuz(urandom(32)) + ciph = GOST3412Kuznechik(urandom(32)) mac(ciph.encrypt, 16, data) diff --git a/www.texi b/www.texi index c872fca4f50c813ba6f15e2c9d1f4bffa582dbeec559c87b5f270b66ff543f00..7231571b5f8917d68fe04267fabaddad3dc341879ec3894380df35f2dc0e59ce 100644 --- a/www.texi +++ b/www.texi @@ -89,6 +89,11 @@ @node News @unnumbered News @table @strong +@item 3.3 + @itemize + @item @code{GOST3412Kuz} renamed to @code{GOST3412Kuznezhik} + @end itemize + @item 3.2 34.13-2015 block cipher modes of operation implementations.